While trying to check if one of my firefox add-on is installed or not, I found that, Chrome resources can no longer be referenced from within <img>, <script>, or other elements contained in, or added to, content that was loaded from an untrusted source. This restriction applies to both elements defined by the untrusted source and to elements added by trusted extensions.
Before firefox 3 we were able to check if a firefox add-on is installed or not as following.
using an image tag to load an image in the firefox add-on.
Once loaded trigger the onload event to verify the add-on is loaded.
< img src=”chrome://youraddonname/content/skin/images/anyimagefilename” width=”0″ height=”0″ onload=”function call here()” style=”visibility:hidden” >;
But this stopped working after firefox 3 and later versions due to security restrictions.
And the extensions won’t interact with the web page in any way.
This caused my add-on checking scripts stopped working.
While digging through the Google, finally found a way to allow interaction with the chrome resources from developer.mozilla.org site.
It is “contentaccessible” flag, which allows the user scripts to check if the add-on is installed or not.
Please note that, The contentaccessible flag applies only to content packages: it is not recognized for locale or skin registration.
However, the matching locale and skin packages will also be exposed to content.
Change your chrome.manifest file as follows
content youraddonname chrome/content/
# Because older versions of Firefox do not understand the contentaccessible flag, any extension designed to work with both Firefox 3 or above
# and older versions will need the above line too
content youraddonname chrome/content/ contentaccessible=yes
Package your add-on and install the new version of your add-on.
Now you will be able to check the add-on is installed as following
< img src=”chrome://your add-on name/content/skin/images/anyimagefilename” width=”0″ height=”0″ onload=”function call here()” style=”visibility:hidden” >
var isInstalled = false;
isInstalled = true;
alert(‘Your addon is installed’);
You can use the variable isInstalled for later use.
Hope this will help others also, who are also trying like me.