Is there a way to detect whether I'm running an extension that was installed from my .crx file or the extension was loaded as via 'Load unpacked extension...' button?
I'm aware about ID differences in that case, but I don't want to rely on hardcoded strings in the code.
On your computer, open Chrome . At the top right, click Extensions . point to "This can read and change site data."
Chrome extensions can be either packed or unpacked. Packed extensions are a single file with a . crx extension. Unpacked extensions are a directory containing the extension, including a manifest. json file.
Storage Location for Packed Extensions. Navigate to chrome://version/ and look for Profile Path, it is your default directory and Extensions Folder is where all the extensions, apps, themes are stored.
If by "installed from my .crx
file" you mean installed from Chrome Web Store you can simply check extension manifest.json
for value of update_url
attribute. CWS adds it when you upload your extension.
If you have a self-hosted .crx
file, get your extension information using chrome.management.getSelf()
and check installType
of returned ExtensionInfo object. If it says "development"
that means that extension was loaded unpacked in developer mode. "normal"
means that it was installed from .crx
file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With