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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -