I tried all solutions in this question
Check whether user has a Chrome extension installed
what I did:
1- I added background js file and in manifest I added the following
"background": { "scripts": ["js/background.js"], "persistent": true }, "permissions": [ "https://*.mydomain.com/*" ], in background.js I added
chrome.runtime.onMessageExternal.addListener(function(msg, sender, sendResponse) { if ((msg.action == "id") && (msg.value == id)) { sendResponse({id : id}); } }); and in my website I added this code
<script> var id = "madbfblbpcoiddlankhkdbagjeemnlof"; chrome.runtime.sendMessage(id, {action: "id", value : id}, function(response) { if(response && (response.id == id)) //extension installed { console.log(response); } else //extension not installed { console.log("Please consider installig extension"); } }); </script> and I always get Please consider installig extension
How can I fix this issue ??