I have a chrome extension which I want to fire whenever I press the popup. Currently I can do this only if I remove the popup.html from manifest.json, since there's a restriction on that. However, I need the popup.html
How do I get both?
I have tried placing the exact same thing everywhere, in the popup.html, in the popup.js (which is linked correctly in the popup.html) and nothing.
In short, if I place this in the background.js:
chrome.browserAction.onClicked.addListener(function(info, tab) {
speakMe();
});
It works.
However, that implies no popup.html in the manifest. So, naturally, I try placing this:
<script>
chrome.browserAction.onClicked.addListener(function(info, tab) {
speakMe();
});
</script>
in the popup.html. It doesn't work. Pressing the icon displays the popup normally, but nothing happens.
I tried placing it in the popup.js too, still nothing. What am I doing wrong?