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.
If by "installed from my
.crxfile" you mean installed from Chrome Web Store you can simply check extensionmanifest.jsonfor value ofupdate_urlattribute. CWS adds it when you upload your extension.If you have a self-hosted
.crxfile, get your extension information usingchrome.management.getSelf()and checkinstallTypeof returned ExtensionInfo object. If it says"development"that means that extension was loaded unpacked in developer mode."normal"means that it was installed from.crxfile.