0
votes

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

1
See this answer, it shows how to do it via page_action which is basically the same thing as browser_action but more suited for your use case. Depending on what "content flow" is there could be different solutions. - wOxxOm

1 Answers

0
votes

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

"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();