Getting error while detect chrome extension installed or not using javascript

前端 未结 2 1562
故里飘歌
故里飘歌 2021-01-20 20:34

Here is My code,

var myExtension = chrome.management.get( \"my_extention_id\" );
if (myExtension.enabled)
{
// installed
}
else { ... }

sou

相关标签:
2条回答
  • 2021-01-20 21:27

    If it's undefined then you're missing the management declaration in the manifest:

    "permissions": [
              "management"
            ],
    

    Source

    0 讨论(0)
  • 2021-01-20 21:32

    Check in another extension:

    https://gist.github.com/greatghoul/321b4f32c0b7a6ad8a97

    Check in webpage

    https://developer.chrome.com/extensions/messaging#external-webpage

    In manifest file, remember to register webpage you want to check extension from.

    "externally_connectable": {
        "matches": ["*://developer.chrome.com/*"]
    }
    

    then you can use chrome.runtime.sendMessage in that page.

    0 讨论(0)
提交回复
热议问题