I have created an extension and I am trying to detect if this extension exists into one of my virtual hosts.
Here is the code for detecting if an extension exists or not: (script.js
)
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 + '/manifest.json';
};
detect('chrome-extension://' + "myExtensionId", function() {alert('boom!');},
function() {alert("buf. nothin")});
When I open my virtual hosts in browser it alerts me: buf. nothin and in console log this error appears:
- Denying load of chrome-extension://myExtensionId/manifest.json. Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension
If I click the extension that I've created, it alerts boom and I receive no errors, so that means in extension it detects my extension, but within my virtual host it does not.
So, detecting if an extension exists within an extension is possible, but it is possible to detect if an extension exists from a Web Page?