I develop a chrome extension which is also compatible with Firefox/Edge/Opera.
The extension rely on a REST API accessible over the web. During the web development, I prefer pointing to a development endpoint where it does not affect the production tenant and only affect a development instance and database.
My question is then quite simple, I would like to make similar to this pseudo-code:
if (extension.downloaded_from_store == true)
endpoint = "https://api-dev.example.com"
else
// The extension has been installed from a local directory
endpoint = "https://api-prod.example.com"
Do you have any idea how I could do such thing (preferably from the background.js page) ?
If the solution can be compatible with all browsers, it would be perfect !
I found the answer in the chrome documentation in the management module:
Link: https://developer.chrome.com/extensions/management#type-ExtensionInstallType
ExtensionInstallType
How the extension was installed. One of:
This allows me to do the following: