Differentiate between extension not installed and installed but not enabled

143 views
Skip to first unread message

Elastic Beaver

unread,
Nov 20, 2024, 5:09:18 AM11/20/24
to Chromium Extensions
Hi, 

I'm trying to figure out a way to differentiate between the case where the extension has been installed but not enabled and the case where extension has not been installed from a webpage. I want to show a different prompt to the user based on this differentiation. I looked up for solutions online and tried the following:
1. External Messaging from the website to the extensions but it fails in both the cases and I don't get any information on whether the user doesn't have the extension or if the user has the extension disabled.
2. Trying to access web_accessible_resources from the website. Tried fetch(chrome-extension://extension-id/path/to/resource) but it fails with GET chrome-extension://invalid/ net::ERR_FAILED in both the cases.
Is there a way to be able to distinguish the state of extension being disabled and extension not installed in the first place from an external website.

Thanks

Oliver Dunk

unread,
Nov 20, 2024, 5:15:12 AM11/20/24
to Elastic Beaver, Chromium Extensions
Hi,

There's no mechanism I can think of that would allow you to do this reliably. In fact, that is very much intentional - an extension which is disabled should not influence the behavior of the browser in any way.

One thing you could do is set some data on install that the site could detect. For example, could you set a cookie on the domain of the website? That would be accessible even after the extension has been disabled. However, it wouldn't account for the case where the extension is later uninstalled by the user.

Thanks,
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB


--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/8fd6b4a7-b34e-4e38-9420-9a03a4cfdf54n%40chromium.org.

Cuyler Stuwe

unread,
Nov 20, 2024, 11:26:18 AM11/20/24
to Oliver Dunk, Elastic Beaver, Chromium Extensions
It seems reasonable that if chrome.runtime.setUninstallURL is justified, chrome.runtime.setDisabledURL would also be justified by the same reasoning.

Some people do temporarily disable extensions that they suspect might be accidentally interfering with a specific site, and then forget to re-enable at a later date. I've done this with 1Password in the past, when there was a long period (on the order of months to a year) where it was causing Upwork to break. It would definitely be useful to be able to send off information that helps your web app to be able to suggest to someone that they should "re-enable" the extension rather than "install" (or "reinstall") it.

Cuyler Stuwe

unread,
Nov 20, 2024, 11:35:03 AM11/20/24
to Oliver Dunk, Elastic Beaver, Chromium Extensions
"an extension which is disabled should not influence the behavior of the browser in any way."

Probably also worth noting that a disabled extension can in fact influence the behavior of the browser. For example, if you uninstall a disabled extension that has an uninstall URL set, it will follow that uninstall URL.

Elastic Beaver

unread,
Nov 22, 2024, 5:21:50 AM11/22/24
to Chromium Extensions, Cuyler Stuwe, Elastic Beaver, Chromium Extensions, Oliver Dunk
Thanks, 

"One thing you could do is set some data on install that the site could detect. For example, could you set a cookie on the domain of the website?".
Would the onInstalled event be fired on extension update if the user has the extension disabled? I might want to set the cookie for existing users.

Oliver Dunk

unread,
Nov 25, 2024, 6:29:01 AM11/25/24
to Elastic Beaver, Chromium Extensions, Cuyler Stuwe
Unfortunately I don't believe onInstalled would fire in that case.
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB

Reply all
Reply to author
Forward
0 new messages