简体   繁体   中英

Make Google Chrome Extension disabled by default

I want to make my Google Chrome Extension disabled by default and then enable it based on the content flow , how could I achieve it ?

Here is the API to make the extension disabled , I need that by default . https://developer.chrome.com/extensions/browserAction#method-disable

In your background page (as configured in manifest.json eg):

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

You can do the following to disable the extension each time a tab is opened::

chrome.tabs.onCreated.addListener(() => {
    chrome.browserAction.disable();
});

Then later, based on flow call chrome.browserAction.enable();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM