Chrome Browser Action click not working
You cannot have a "popup" with an onclick event. Remove the popup.html from the manifest file. And keep the background page, and it will work.
I found the root cause with my problem on :- MDN
browserAction.onClicked:- Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup.
removed the deafult_popup from manifest.json
"browser_action": {
"default_icon": "img/icon.png",
"default_popup": "popup.html"
}
You need delete the popup.html, you already have a popup in popup.html in theory the background.html should do the event for browserAction but is wrong. When you clicked in the Icon of you app there's already defined an function onClicked in popup.
i dont know for what you need, but you can make many functions when you clicked in the browser.
For example: in background.html do:
foo(){
if(browserAction && browserAction.onClicked) // you can add all stuff that you need.
do something
}
and you call from popup.html with chrome.extension.getBackgroundPage().foo();
well i hope this help you.