Detect source of Installation

84 views
Skip to first unread message

Flo

unread,
Aug 14, 2024, 10:35:48 AMAug 14
to Chromium Extensions
Is it possible to programmatically detect from within a (cross-browser) extension from which store (CWS, Firefox Addons, Microsoft Store) it was installed from? Thanks!

Patrick Kettner

unread,
Aug 14, 2024, 12:05:39 PMAug 14
to Flo, Chromium Extensions
Hi Flo!
Chrome and Firefox expose chrome.runtime.getManifest().update_url, which will tell you the server that the extension was installed from (assuming it was from a public server - sideloaded extensions as well as some types of policy installations amy not have this attribute). Firefox has this property available in browser.runtime.getManifest().browser_specific_settings.update_url. I believe (but could be mistaken) that Mozilla doesn't add these values, it just reflects what is in the actual manifest file. However the object returned from brower.runtime,.getManifest() inherits from the a prototype that defined the key. So you can do `const isFirefox = "browser_specific_settings" in browser.runtime.getManifest()` and that should work as a gross inference of the environment.

best
patrick

On Wed, Aug 14, 2024 at 7:35 AM Flo <flori...@gmail.com> wrote:
Is it possible to programmatically detect from within a (cross-browser) extension from which store (CWS, Firefox Addons, Microsoft Store) it was installed from? Thanks!

--
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 on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/bc639383-4d60-451a-aa58-22a2d72b4f00n%40chromium.org.

Flo

unread,
Aug 14, 2024, 2:12:51 PMAug 14
to Chromium Extensions, Patrick Kettner, Chromium Extensions, Flo
Awesome, thank you!
Reply all
Reply to author
Forward
0 new messages