hello, i have a lot of problems detecting active extensions on browser and i was spending a lot of time to search on google to find solution and i found 2 solutions:


first solution

second:
Code:
var detect = function(base, if_installed, if_not_installed) {
    var s = document.createElement('script');
    s.onerror = if_not_installed;
    s.onload = if_installed;
    document.body.appendChild(s);
    s.src = base;
    
}
var log = function(msg) {
    document.getElementById('log').value += '[*] ' + msg + '\n';
}

function logme(i, id) {
    return function() {
        log('Detected addon: ' + i + ' (' + id + ')');
    }
}

window.onload = function() {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', 'addons.json', false);
    if(xhr.status == 404) alert("ok");
    xhr.onreadystatechange = function() {
      if (xhr.readyState == 4) {
         var addons = JSON.parse(xhr.responseText);
         for (var i in addons.prob) {
                detect('chrome-extension://' + addons.prob[i].id + addons.prob[i].fajl,logme(addons.prob[i].ime, addons.prob[i].id));
                
         }
         
      }
    }
    xhr.send(null);
}
addons.json:
Code:
{ 
    "prob":[
        {
            "id":"elicpjhcidhpjomhibiffojpinpmmpil",
            "ime":"Video Downloader professional",
            "fajl":"/startpage/hu/L64P.js"
        },
        {
            "id":"mpfambnfjgnnbmldefnhdjinogehhjem",
            "ime":"web developer",
            "fajl":"/manifest.json"
        },
        {
            "id":"jffbcpkfdlpegbadfomimojhgaaoaeed",
            "ime":"moviepie",
            "fajl":"/logo128.png"
        }
    ]
}
but for both scripts i have the same problem. some extensions doesen't allow to access file or image from source if is not named in web_accessible_resources (manifest.json) and i get error like this:
Code:
Denying load of chrome-extension://mpfambnfjgnnbmldefnhdjinogehhjem/manifest.json. Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension.