Check if a firefox addon is installed or not

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.
For example,
< 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.

Continue reading “Check if a firefox addon is installed or not”

Disable Text Selection in a web page

Here is a sample code snippet, which can be used to disable the text selection in a web page.

But selecting text inside input fields, such as Textarea, textbox and Select (combo) box is not restricted.

//get the browser name,version details
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }

//variables to hold the browser names, and versions
var is_ie = false;
var is_ff15 = false;
var is_ff20 = false;
var is_ff30 = false;
    is_ie = true;
else if(agent('firefox/3.0.0'))
    is_ff30 = true;
else if(agent('firefox/2.0.0'))
    is_ff20 = true;
else if(agent('firefox/1.5'))
    is_ff20 = true;

/* This is the function which Disables Text Selection in the Document*/
function selstart(e){
    //if not ie and !not ie then return
    if (!agent('msie') && !(!agent('msie')))

    var selobj=(!agent('msie'))? : event.srcElement
    var topelement=(!agent('msie'))? "HTML" : "BODY"

        if ( selobj.tagName!=topelement &&
                (selobj.tagName=='SELECT' ||
                selobj.tagName=='TEXTAREA' ||
                  return true;
            return false;


This function uses another function named agent to get the browser agent name, whether the user’s browser is Firefox or IE or others. And some global variables for storing browser names and versions.

Whenever a select text event (onselectstart) is fired, the function selstart is executed and the text selection inside the web page is restricted. The function will return true to disable text selection.