javascript - Unable to call chrome api from script inside HTML -
i new javascript chrome extension development. trying open tab when user clicks on extension button. how popup.html
looks
<!doctype html> <head> <title> qoogle homepage</title> <script type="text/javascript"> var newurl = chrome.extension.geturl('qoogle.html'); chrome.tabs.create({ url: newurl }); </script> </head> </html>
i have declared tabs
permission in manifest.json
, qoogle.html
lays in same directory. when click on extension, nothing happens.
now, tried include <script src="popup.js"></script>
line popup.html
, wrote
var newurl = chrome.extension.geturl('qoogle.html'); chrome.tabs.create({ url: newurl });
inside popup.js file. works fine.
i don't want many files in folder. reason script not executed html , works fine when added separately js file?
as stated in docs:
https://developer.chrome.com/extensions/contentsecuritypolicy#jsexecution
inline javascript not executed
check out answer well: https://stackoverflow.com/a/27913209/3052648
Comments
Post a Comment