Why is chrome.browserAction.onClicked undefined?

前端 未结 6 1171
情书的邮戳
情书的邮戳 2020-12-02 18:38

I\'m writing a Chrome extension that will redirect me to a URL when clicking on the browser action icon.

I\'m trying to use:

chrome.browserAction.onC         


        
6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 18:56

    For those who already have added something like

    "background": {
        "scripts": ["background.js"]
    }
    

    and still gets Cannot read property 'onClicked' of undefined - just add

    "browser_action": {}
    

    into your manifest.json

    edit: thanks @Pacerier for his comment, I've changed my answer

提交回复
热议问题