Why is chrome.browserAction.onClicked undefined?

前端 未结 6 1170
情书的邮戳
情书的邮戳 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 19:13

    If you do not have a "browser_action" property defined in your manifest.json then this error may occur. @Kirill's answer works but you also have to add a blank icon.png file else chrome will throw an error that it cannot find such a file.

    Adding this to the manifest.json file should suppress this is error:

    "browser_action": {}
    

    Be sure to read the documentation for further reference on how to use the "browser_action" setting.

提交回复
热议问题