...making Linux just a little more fun!

<-- prev | next -->

Taking control of your browsing with Mozilla

By Neil Youngman

Web surfing has more than its fair share of annoyances. I'm thinking of popups, pop unders, flash and other intrusive ads. Sometimes you can spend ages waiting for a site to load, when the delay isn't on the site itself: it's waiting for an ad server to serve up another irrelevant, bandwidth wasting graphical annoyance.

Fortunately Mozilla, Free Software's most popular browser, has the solutions. The most effective option is the Adblock plugin, which can be combined with the built-in popup blocker to block practically all unwanted ads. Mozilla also has an option to block images from specific sites.

NOTE: If you're not yet a card carrying Penguinista, there is nothing in this article that is Linux specific. All the options described here should work as described under all operating systems supported by Mozilla. It should also work with recent versions of Netscape.

The Adblock plugin

The Adblock plugin is probably the most comprehensive solution to annoying ads in Mozilla. Due to its power and flexibility it takes a little more work than some of the other options to set up, but it's really not that difficult. If you do find it too complicated, then start with the other options described below.

To install Adblock go to the installation page and follow the links from there. At the time of writing there are only development builds available. Following the link to "Dev. Builds", you should find a link that's called something like "Adblock 0.5 d2 nightly 35". If you click on this, it should prompt you to ask whether to install the plugin.

If you accept the installation, the next prompt asks if you want to install to your profile. Clicking 'Cancel' attempts to install to the system wide chrome directory, for which you need to have the necessary privileges. If you do not, it offers to attempt to force the installation.

If the software installation doesn't activate when the link is clicked, it may be disabled in your configuration. To fix this, go to "Edit->Preferences->Advanced->Software installation", check "Enable software installation", and click OK. You should now be able to go back and complete the installation.

Once the plugin is installed Mozilla must be restarted to activate it.

You should now see "Adblock" underlined in the bottom right hand corner of your browser, and the tools menu should have an Adblock submenu. If that's all there you are ready to start using Adblock.

The principle behind the Adblock plugin is that you can tell it block URLs (web addresses) matching a certain pattern. So for example, if you enter the pattern /adserver/, then http://example.com/adserver/annoying_flash.swf will be blocked. An asterisk will match any texts, so the pattern *://*annoyingads.com/ will block anything in the domains annoyingads.com and veryannoyingads.com.

The question now is, how do you select which patterns to block?

I suggest starting by picking a site that you like, but which suffers from having too many ads. Once the page has loaded, clicking on the "Adblock" text in the bottom right hand corner will popup a list of blockable items in the current page. The ads are usually very obvious. The addresses will contain names related to advertising. Click on one of these and edit it down to a suitable pattern, then select another page from the site and see if it's blocked the right things.

Some care must be taken in your choice of patterns to block. Simply selecting "ads" as a pattern will block http://example.com/downloads/ as well as http://toomanypopups.com/ads/, whereas the pattern "/ads/" will only block directories called ads.

Don't spend a lot of time setting this up initially. Just web surf as normal and setup a few more filters whenever a site takes too long to download or you are annoyed by popups and other ads.

Popup Blocking

The simplest option provided by Mozilla is popup blocking. The Adblock plugin isn't 100% effective at blocking popup ads, so you may find this option a useful addition. Popup blocking can also be used on its own and it is highly effective at blocking popups, but it will not block ads in the main window.

The main downside to popup blocking is that some sites rely on popups for their operation. When a function on a site isn't working, it is important to remember that you have blocked popups and to see if unblocking popups for that site solves the problem.

To enable popup blocking, go to "Edit->Preferences->Privacy And Security->Popup Windows", check "Block Unrequested Popup Windows", and click OK. You can unblock popups for specific sites by selecting "Tools->Popup Manager->Allow Popups From This Site". You don't have to unblock all popups to get one site working.

There are also options to have Mozilla play a sound or display an icon when it blocks a popup, which may help to remind you that popups are blocked when a site isn't working as expected.

Blocking images from a specific server

It is also possible to block some ads by clicking the right mouse button on an image and selecting "Block images from this server". This option will not always be available, e.g. the shockwave plugin replaces this menu, so this can't be used with Flash movies.

I would recommend using the Adblock plugin, rather than this option.

Alternate solutions

If you want a solution for other browsers, or you just want to check out the alternatives, take a look at privoxy, which can be found at http://www.privoxy.org/.



Neil is a programmer, specialising in C++ on Unix and Linux. He has degrees in Computer science and Next Generation Computing.

Neil has worked on a wide range of systems from the control system for the British Gas national grid to video servers for the Home Choice video on demand service. He first programmed computers in 1980 with his school General Studies class, which was allowed access to a mainframe at The National Institute of Oceanography, programmed in Fortran on punch cards.

A computer science degree followed at Queen Mary College, London, then Neil worked for Logica for 3 years before taking an MSc in New Generation Computing at Exeter University.

The next 5 years saw Neil researching parallel simulation algorithms at the Royal Signals and Radar Establishment, initially on transputers and subsequently on SPARC based parallel systems. Since leaving RSRE, Neil has mostly worked freelance and has worked on financial data feeds, video servers and virus scanning proxies.

Neil first used Unix at college in 1982 and started working on Linux in 1996.

As of May 2004, Neil is working for Wirefast a global messaging company.

Outside of computing, Neil is into motor sport, particularly Formula 1, the World Rally Championship and the British Touring Car Championship. He doesn't race himself. If you've seen Neil's driving, you'll understand why.

Copyright © 2004, Neil Youngman. Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 104 of Linux Gazette, July 2004

<-- prev | next -->