Google Chrome browser extension detection

I was looking for a way to detect the browser extension that I create on my website, and I need to warn my users if they browse my site without it. I was able to do this in firefox, but I want to know if there is a way to do this in Google Chrome? Even if there is a hack it, I'm fine.

+5
source share
2 answers

Of course. Create a script content specific to your site in the extension and add an invisible marker in the DOM, for example:

$('body').append('<div style="display: none;" class="extension_enabled" />');

Set a short timeout on the page to check this after the document has fully loaded, for example:

$(function() {
  setTimeout(function() {
    if ($('.extension_enabled').length > 0) {
      alert('Installed!');
    } else {
      alert('Not installed.');
    }
  }, 500);
});

NOTE: The code is in jQuery format for simplicity. Of course you can do this with raw javascript.

+2

Google Chrome , .

+2

All Articles