Organizational Research By

Surprising Reserch Topic

check whether user has a chrome extension installed

check whether user has a chrome extension installed  using -'javascript,google-chrome,google-chrome-extension'

I am in the process of building a Chrome extension, and for the whole thing to work the way I would like it to, I need an external JavaScript script to be able to detect if a user has my extension installed.

For example: A user installs my plugin, then goes to a website with my script on it. The website detects that my extension is installed and updates the page accordingly.

Is this possible?

asked Sep 22, 2015 by sameer rathore
0 votes

Related Hot Questions

9 Answers

0 votes

I am sure there is a direct way (calling functions on your extension directly, or by using the JS classes for extensions), but an indirect method (until something better comes along):

Have your Chrome extension look for a specific DIV or other element on your page, with a very specific ID.

For example:

Do a getElementById and set the innerHTML to the version number of your extension or something. You can then read the contents of that client-side.

Again though, you should use a direct method if there is one available.

EDIT: Direct method found!!

Use the connection methods found here:

Untested, but you should be able to do...

var myPort=chrome.extension.connect('yourextensionid_qwerqweroijwefoijwef', some_object_to_send_on_connect);
answered Sep 22, 2015 by maurya
0 votes

Chrome now has the ability to send messages from the website to the extension.

So in the extension add something like:

    function(request, sender, sendResponse) {
        if (request) {
            if (request.message) {
                if (request.message == "version") {
                    sendResponse({version: 1.0});
        return true;

This will then let you make a call from the website:

var hasExtension = false;

chrome.runtime.sendMessage(extensionId, { message: "version" },
    function (reply) {
        if (reply) {
            if (reply.version) {
                if (reply.version >= requiredVersion) {
                    hasExtension = true;

You can then check the hasExtension variable. The only drawback is the call is asynchronous, so you have to work around that somehow.

Edit: As mentioned below, you'll need to add an entry to the manifest.json listing the domains that can message your addon. Eg:

"externally_connectable": {
    "matches": ["*://localhost/*", "*://*"]
answered Sep 22, 2015 by ashishshukla
0 votes

I thought I would share my research on this. I needed to be able to detect if a specific extension was installed for some file:/// links to work. I came across this article here This explained a method of getting the manifest.json of an extension.

I adjusted the code a bit and came up with:

   function Ext_Detect_NotInstalled(ExtName,ExtID) {
   console.log(ExtName + ' Not Installed');
   if (divAnnounce.innerHTML  != '')
   divAnnounce.innerHTML = divAnnounce.innerHTML + "
" divAnnounce.innerHTML = divAnnounce.innerHTML + 'Page needs ' + ExtName + ' Extension -- to intall the LocalLinks extension click' + ExtID +'">here'; } function Ext_Detect_Installed(ExtName,ExtID) { console.log(ExtName + ' Installed'); } var Ext_Detect = function(ExtName,ExtID) { var s = document.createElement('script'); s.onload = function(){Ext_Detect_Installed(ExtName,ExtID);}; s.onerror = function(){Ext_Detect_NotInstalled(ExtName,ExtID);}; s.src = 'chrome-extension://' + ExtID + '/manifest.json'; document.body.appendChild(s); } var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; if (is_chrome==true) { window.onload = function() { Ext_Detect('LocalLinks','jllpkdkcdjndhggodimiphkghogcpida');}; }

With this you should be able to use Ext_Detect(ExtensionName,ExtensionID) to detect the installation of any number of extensions.

answered Sep 22, 2015 by jekbishnoi
0 votes

You could have the extension set a cookie and have your websites JavaScript check if that cookie is present and update accordingly. This and probably most other methods mentioned here could of course be cirvumvented by the user, unless you try and have the extension create custom cookies depending on timestamps etc, and have your application analyze them server side to see if it really is a user with the extension or someone pretending to have it by modifying his cookies.

answered Sep 22, 2015 by nikhilapatil
0 votes

Another possible solution if you own the website is to use inline installation.

if ( {
  // extension is installed.

I know this an old question but this way was introduced in Chrome 15 and so I thought Id list it for anyone only now looking for an answer.

answered Sep 22, 2015 by sachin wagh
0 votes

Your extension could interact with the website (e.g. changing variables) and your website could detect this.

But there should be a better way to do this. I wonder how Google is doing it on there extension gallery (already installed applications are marked).


The gallery use the function. Example:"mblbciejcodpealifnhfjbdlkedplodp", function(a){console.log(a);});

But you can only access the method from pages with the right permissions.

answered Sep 22, 2015 by nikhilapatil
0 votes

There's another method shown at this Google Groups post. In short, you could try detecting whether the extension icon loads successfully. This may be helpful if the extension you're checking for isn't your own.

answered Sep 22, 2015 by r3tt
0 votes

Another method is to expose a web-accessible resource, though this will allow any website to test if your extension is installed.

Suppose your extension's ID is aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, and you add a file (say, a transparent pixel image) as test.png in your extension's files.

Then, you expose this file to the web pages with web_accessible_resources manifest key:

  "web_accessible_resources": [

In your web page, you can try to load this file by its full URL (in an tag, via XHR, or in any other way):


If the file loads, then the extension is installed. If there's an error while loading this file, then the extension is not installed.

// Code from
function detectExtension(extensionId, callback) { 
  var img; 
  img = new Image(); 
  img.src = "chrome-extension://" + extensionId + "/test.png"; 
  img.onload = function() { 
  img.onerror = function() { 
answered Sep 22, 2015 by 20shahi
0 votes

I used the cookie method:

In my manifest.js file I included a content script that only runs on my site:

 "content_scripts": [
        "matches": [
        "js": ["js/mysite.js"],
        "run_at": "document_idle"

in my js/mysite.js I have one line:

document.cookie = "extension_downloaded=True";

and in my index.html page I look for that cookie.

if (document.cookie.indexOf('extension_downloaded') != -1){
    document.getElementById('install-btn').style.display = 'none';
answered Sep 22, 2015 by vijaygupta1980