Unable to trigger chrome.browserAction.onClicked.addListener with google chrome extensions

前端 未结 1 1328
清酒与你
清酒与你 2020-12-10 04:00

I\'m a bit stuck here and was wondering if anyone can point out where I might be wrong.

I am simply trying to make the body color change to red on click of the app i

相关标签:
1条回答
  • 2020-12-10 04:26

    If you define default_popup, you can't have a listener for browserAction.onClicked. In this case you can simply add the code in your handler to your popup.js.

    EDIT: That is, add to popup.js the following:

    chrome.tabs.executeScript(null, {code:"document.body.bgColor='red'"});
    
    0 讨论(0)
提交回复
热议问题