Nads: My First Firefox Extension

Posted by Curtis Miller Curtis Miller

This extension is no longer available.

Sorry, but this was so long ago, it has been lost to the ages!

Yesterday, I desired to learn more about building an extension for Firefox. It seemed like it would be something worthwhile to check out. I decided that I would try to create something small, just to see the process behind creating one and get familiar with the technologies used in the implementation of the extension.

Firefox extensions are implemented in XUL and JavaScript. I found the information on the Mozilla developer site to be most helpful while playing around with this; especially the tutorial and FAQ. I also downloaded and perused the Firebug source code to use as an example of how to add an item to the statusbar, etc.

Update: I forgot to link to another great tool that I found useful during the development of this extension. It is called Extension Developer's Extension.

The small project I decided to attempt for this first extension was based around modifying DOM objects from the Firefox extension. Basically, I wanted to be able to hide ads on a page by enabling the extension. In this way I not only create an extension to Firefox, but also learned how to manipulate the content in the browser through the extension. I called it Nads, short for No Ads. This is by no means a great extension, but it taught me quite a bit about how to create a Firefox extension.

Licensing

Creative Commons Attribution-Share Alike 3.0 United States License.

That being said, you may download the code from my subversion repository:

Sorry, this project died... :(

Installation

If you want to install Nads, just click on the link below. It should follow the standard installation procedure for a Firefox extension. You may see a Firefox message that tells you Firefox prevented the site from installing the extension. If that happens, then click the 'Edit Options' button and add millarian.com to the list of trusted sites. Then click the installation link again. This is a necessary part of the installation procedure.

If you want to remove millarian.com from the list of trusted sites after installing, just go to the Firefox preferences window (On Windows => Tools | Options) and click 'Security'. Click the 'Exceptions' button next to the checkbox labeled “Warn me when sites try to install add-ons”. Select millarian.com in the list and click 'Remove Site'.

After you install the extension, it will ask you to restart Firefox. When Firefox is back up, you will see an orange asterisk in the lower right corner of the screen on the status bar. If you don't see the status bar, it may be disabled. Click View | Status Bar to enable it. The orange asterisk indicates that Nads is currently turned off. Clicking on the orange asterisk will enable Nads (and make the icon yellow); clicking again will disable it. You can turn it on or off as you like and it will retain that preference in the current window (across all tabs). Upon closing Firefox or opening a new window, the preference again defaults to off.

After you install, try it out on Google, Yahoo!, Techcrunch, etc. Admittedly it does not work for all ads, but it catches a fair portion.

Sorry, this project died... :(

Contribute

Since this is my first Firefox extension, I am really interested in hearing ideas to improve it. I would like to see the implementation change to account for more ads without resorting to manual addition of the ad class or id. I found that on some sites, ads are simply smashed forcefully into the page and don't have an id or class. In these cases, Nads will not remove them. Ideas for how to solve this problem would be greatly appreciated.

Leave your comments below or contact me using the information in the footer.

If nothing else, I hope this can serve as a starting point for other people interested in learning a little about extensions in Firefox.



Velocity Labs

Need web application development, maintenance for your existing app, or a third party code review?

Velocity Labs can help.

Hire us!