Getting error while detect chrome extension installed or not using javascript

前端 未结 2 1561
故里飘歌
故里飘歌 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: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.

提交回复
热议问题