How to tell if a Chrome extension is installed by a real user vs. by me during development?

后端 未结 2 450
有刺的猬
有刺的猬 2021-01-13 10:03

I\'m using Analytics in my Chrome extension. I want to execute the analytics code only if the extension is being used by a real person (not me while I\'m working on it). Are

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-13 10:44

    Your production extension will have a single extension_id that will not change while your unpacked extension will have a random extension_id that will change if you remove and load it again. You can use the il8n API to get the extension_id check if it matches the production extension_id.

    var extensionId = chrome.i18n.getMessage('@@extension_id');

提交回复
热议问题