How to find out if the Chrome extension is enabled (after disabling it)

Suppose a user disables my extension and then allows it.

How to run a function when you turn on the extension?

I tried to do something similar to running the on-extension-install function using localStorage, but it does not work for this case with the extension-reenabled, because localStorage is not cleared for the background page when it is turned off.

if (!localStorage["isInstalled"]) {
onInstall();
localStorage["isInstalled"] = 1;
}
+5
source share
2 answers

The extension itself cannot control when it is disabled. You will need a second extension to track this.

sessionStorage["isInstalled"] = 1;, , , , , Chrome.

+2

API , , onEnabled, , .

+1

All Articles