I have my Chrome extension and website that host button for navigation to my extension.
There are plenty of solutions online, but none of them worked for me as well for some other people. I've tried an inline installation which is awesome but it will be deprecated next month.
What is the easiest way to find out is my Chrome extension already installed so I can hide the installation button?
Here is some latest thing I have tried, but all the time I'm getting the false value:
Background.js
chrome.runtime.onMessageExternal.addListener(
function(request, sender, sendResponse) {
if (request) {
if (request.message) {
if (request.message == "version") {
sendResponse({version: 1.0});
}
}
}
return true;
});
Here is my website component:
window.chrome.runtime.sendMessage('kgpphmdamkaepmgiepihmihoohflolkf', { message: 'version' },
function (reply) {
if (reply) {
if (reply.version) {
if (reply.version >= requiredVersion) {
console.log('true');
}
}
}
else {
console.log('false');
}
});
manifest.json :
"externally_connectable": {
"matches": ["*://localhos:8080/*", "*://search.call.com/*"]
}