Check if Chrome extension installed in unpacked mode

前端 未结 3 1332
独厮守ぢ
独厮守ぢ 2020-12-08 10:23

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?

3条回答
  •  眼角桃花
    2020-12-08 11:09

    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.

提交回复
热议问题