javascript - Google Chrome extension won't output expected text -
i creating google chrome extension generating passwords. working in html page on extension won't output password in text field. working html page, non working extension
does google chrome extensions work differently html? need special in manifest.json?
popup.html below
<html> <head> <title>random password generator</title> <style> body { font-family: "segoe ui", "lucida grande", tahoma, sans-serif; font-size: 100%; } #status { /* avoid excessively wide status text */ white-space: pre; text-overflow: ellipsis; overflow: hidden; max-width: 1000px; } </style> <!-- - javascript , html must in separate files: see our content security - policy documentation[1] details , explanation. - - [1]: https://developer.chrome.com/extensions/contentsecuritypolicy --> <script src="popup.js"></script> </head> <body> <div id="status"></div> <img id="image-result" hidden> <form name="pgenerate"> <input type="text" size=18 name="output"> <input type="button" value="generate password" onclick="populateform(this.form.thelength.value)"><br /> <b> <font size="1"> password length: </font> </b> <input type="text" name="thelength" size=3 value="12"> </form> </body> </html>
popup.js below
var keylist="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*().?/`~" var temp='' function generatepass(plength){ temp='' (i=0;i<plength;i++) temp+=keylist.charat(math.floor(math.random()*keylist.length)) return temp } function populateform(enterlength){ document.pgenerate.output.value=generatepass(enterlength) }
and manifest.
{ "manifest_version": 2, "name": "random password generator", "description": "this extension generates random 20 character strong passwords you. these passwords includes both lower , upper case letters , special characters. can copy password, paste in password generating window , google chrome save password if chose remember password. in easier log in solutions.", "author": "sheheryar ahmad", "version": "1.0", "browser_action": { "default_icon": { "19": "images/icon19.png", "38": "images/icon38.png" }, "default_popup": "popup.html", "default_title": "random password generator" }, "permissions": [ "activetab", "https://ajax.googleapis.com/" ] }
Comments
Post a Comment