Run script each time Chrome extension icon clicked

前端 未结 5 1207
有刺的猬
有刺的猬 2020-12-02 06:44

How do I write a chrome extension such that every time a user clicks the icon, my script is run but no popup is opened? (I would look this up in the docs myself but for wha

5条回答
  •  无人及你
    2020-12-02 07:00

    Remove popup from your browser_action section of the manifest and use background pages along with browser Action in the background script.

    chrome.browserAction.onClicked.addListener(function(tab) { alert('icon clicked')});
    

提交回复
热议问题