I know there is a way to make JS work in chrome extension: just include a default_popup parameter in your manifest.json to specify an HTML page, then include the JS onto the HTML using <script>. But is there a way to get JS to do some stuff without having to open a HTML page (e.g. change the icon of the extension without a HTML popup having to be opened)?
I know there is a way to make JS work in chrome extension: just
Share
Yes, that is called background page. You can create it without a
.htmlfile, but it will dynamically create one for you, called_generated_background_page.html.You can can add following to your
manifest.jsonto specify a background page:To view the background page go to
chrome://chrome/extensionsactivate “Developer mode” and you can see the background page with developer tools:For your example, changing the icon, you could use the
chrome.browserAction.