I'm having a difficult time understanding how to have some JS to run when the chrome extension icon has been clicked. I'd like to for example, read some properties from the document, when the icon has been clicked.
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": [
"activeTab",
"clipboardWrite"
]
And inside the popup.html
, I have the following:
chrome.browserAction.onClicked.addListener(function(tab) {
alert('working?');
});
But, this doesn't appear to be working. I tried having the JS above inside a background script (inside manifest.json
) but that didn't work either.