Developing a Browser Toolbar: Mozilla Firefox (2/5)

This post series reflects my article “Developing a Browser Toolbar” published in the ASPects in January 2010 (Volume 23, Issue 1), a magazine of the Association of Shareware Professionals (ASP).

Developing a toolbar for Firefox is quite easy: it’s all done by using XML, a little bit of CSS and especially JavaScript. The last one is also the only crux of the matter, because I really don’t like to develop in JavaScript. But anyway, it’s straightforward in this case.

I found a very good resource in the web. This tutorial explains the development of a Firefox toolbar in detail and saved me a lot of research work. After you went through the online tutorial, you should already have a fully-functional Firefox toolbar. There are only two things left:

Automatic online update

I wanted my toolbar to receive automatic updates from my webserver. But this is also quite easy by using the integrated update system of Firefox. On the same website there is a good tutorial for adding automatic update support, too.

Uninstall button inside the toolbar

The disreputability of toolbars is surely not least based on the fact that most of them are really hard to uninstall. Although Firefox provides uninstall support to the user already by using the add-ons manager, I wanted an uninstall button to be included directly into the toolbar itself. After doing some research in the web and at the Mozilla Developer Center, I got together the following piece of code that first successfully uninstalls the toolbar, second shows a webpage to the user (something like “We’re sad that you uninstalled…”) and finally tells the user that a browser restart is needed to finish the uninstallation:

try {
    var tb = document.getElementById('ABTools-Toolbar');
    var text = ABTools_ToolbarData["msg.uninstallToolbarText"].replace("%name%",
    if (!window.confirm(text))

    var gExtensionManager = Components.classes[";1"]
    var rds = gExtensionManager.datasource;
    if (gExtensionManager.uninstallItem) gExtensionManager.uninstallItem(ABTools_id);
    if (gExtensionManager.uninstallExtension)

    ABTools_guid = "";


} catch(e) {
    if (ABTools_DebugMode) alert(e);

After going through these steps your Firefox toolbar is ready to get installed! It will work on Firefox Version 1.5 or higher, not depending on the version of the operating system.

In the next post I will go to the more complicated browser.

Contents of Post Series “Developing a Browser Toolbar”:

This post is also available in Deutsch.

2 thoughts on “Developing a Browser Toolbar: Mozilla Firefox (2/5)

  1. Pingback: Developing a Browser Toolbar: Introduction (1/5) |

  2. Pingback: Developing a Browser Toolbar: Installation System (4/5) |

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>