Click here to Skip to main content
13,145,603 members (36,806 online)
Click here to Skip to main content
Add your own
alternative version


9 bookmarked
Posted 29 Jul 2008

Detecting a Firefox Extension Using JavaScript

, 29 Jul 2008
Rate this:
Please Sign up or sign in to vote.
The following explanation will help you understand how to detect if a Firefox extension is installed on your system. This also handles the problems you might face using Firefox 3.


The article will be helpful for developers of Firefox extensions (add-ons). It describes how your web pages can detect if an extension is currently installed in your browser.


The requirement is of a very typical distribution policy, where we deliver our extensions using the most popular pages of our website. Each of these popular pages, when visited, would detect if the extension if already installed; if so, it shouldn't make an attempt to download and install the extension again. However, if the extension is not installed, it can be downloaded and installed.

The code can further take care of settings cookies, and doing it periodically (once in a week), in case a user denies to install the extension - for whatever reason.

Using the code

I was stuck with detecting the existence of an extension (add-on) in Firefox using JavaScript. I used the following code to detect the presence of an extension:

<img src="chrome://toolbar/content/logo.png" 

 onload="var a=document.getElementById('PlugInStatus'); 
    a.innerHTML = 'You are using the plug-in';" 

    style="visibility: hidden;" />

<span id="PlugInStatus">You are not using the plug-in</span><noscript> 
      and/or you don't have JavaScript turned on</noscript>

The problems started arising with the launch of Firefox 3 RC1. The above code always failed from the HTMLs I needed to detect the plug-in. Browsing through Mozilla Dev docs, I came across the following: However, there wasn't much available telling me what file(s) exactly I should modify.

Well, here is the answer for those who are stuck with something similar:

  1. Locate your chrome.menifest at the plug-in installation location, typically located at:
  2. C:\Documents and Settings\sauda\ApplicationData\Mozilla\Firefox\
  3. Open chrome.menifest and edit the contents as shown below:
  4. Existing code:

    content toolbar jar:chrome/toolbar.jar!/content/toolbar/ 

    Updated code:

    content toolbar jar:chrome/toolbar.jar!/content/toolbar/ 
    content toolbar jar:chrome/toolbar.jar!/content/toolbar/ contentaccessible=yes 

Both the lines are important as the first one makes it work in Firefox 2.0, since this version of Firefox doesn't understand the contentaccessible keyword. And, the second one is required for Firefox 3.0.

Kill any current instances of Firefox before you test your HTMLs/JSs.

Points of Interest

An interesting argument about the same can be found at Mozilla's Bugzilla system:

Another interesting read with reference to "Chrome" is available at:


  • Draft version: 1.0 - 30/July/2008.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
India India
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralMy vote of 5 Pin
Manfred R. Bihy31-Mar-11 0:53
memberManfred R. Bihy31-Mar-11 0:53 
I'm not sure why this article was not appreciated. I liked it rather well. 5
GeneralRe: My vote of 5 Pin
saud_ad14-Jul-17 5:57
membersaud_ad14-Jul-17 5:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.170915.1 | Last Updated 30 Jul 2008
Article Copyright 2008 by saud_ad
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid