Blocking Adverts and Malware


While browsing the Internet the quality of the service you receive may be degraded by various factors such as adverts & maleware most of these undesirable elements are simply annoying, and to dial-up users in particular are costly, but some may be serious security threats.

Many commercial web sites sell advertising space. The unobtrusive adverts are small text-based adverts that neither interrupt the flow of the site nor masquerade as anything other than an advert. Small non-animated graphic banners, are also fairly low impact to most users. However, advertising on the web is inefficient, virtually no one pays attention to them, so advertisers have had to increase the size of the their adverts and add movement or sound to get people's attention. This has resulted in sites that are almost unreadable because of the intrusive advertising.

Many adverts also set cookies to keep track of your browsing habits. While they do not identify you as an individual per se it does allow the advertiser to build up a fairly good profile of you, and to know what kind of adverts you may be interested in. Advertisers are usually not based in your country and are not subject to the same legal rules designed to protect you within your country. They could merge identifiable data and their advertising profile, and therefore know a considerable amount of information about you that you may not wish a commercial organisation to know about.

As well as the annoying adverts there are actively hostile programs that can be installed on your computer while you surf the Internet. Some of them are simply spying on your browsing habits, others are actively looking for data that can be used for criminal purposes, such as your logon details at your bank. Other forms of malware are programs that changes your computer, for example changing your home page without your permission, or changing your dial-up account to a premium-rate phone number in another country.

Blocking via hosts/DNS Filtering

One simple idea is to configure a computer's name to IP resolution so that many well known advertising and "undesirable" servers return an IP address that goes no where, e.g. An easy way to do this is to download an anti-advert hosts table of the Internet and append it to your hosts file. You can also configure your DNS to do the same if you want to block sites on a network. A quick Google search will find many such hosts files to use, and it is a great way of protecting children or parents. Periodically you need to simply update your hosts table, no other maintainance is required.

This approach works for all browsers, and pretty much all operating systems. It is also less obvious than the various "safe" surf tools, that most children can get round. Additionally, it is cheaper than commercial software.

Web Proxy Server

If you have a number of computers to protect, then it may be worth considering using a advert blocking web proxy. There are several to choose from, both free and commercial. The proxy simply sits between the web browser and the Internet, but unlike a normal proxy server, the advert blocking versions filter out adverts using a list of rules.

Though there is some configuration required, both for the proxy server, and for each browser used, this approach works well on all computers and for any browser.

Use a Good Browser

All browsers other than Microsoft's IE, provide good out-of-box advert control features, along with other benefits. The Browse Happy site has some useful suggestions and some nice stories from non-technical people who have made the switch.

Browsers such's Firefox, Google's Chrome or Opera, have nice out of the box control features. None support Microsoft's ActiveX technology, the source of the majority of malware, and block pop-ups by default. They also support the W3C standards better than IE, and offer a number of other security, privacy and convenience features that IE does not.

If you are running Windows Vista/7 the latest version of Microsoft IE is significantly better than the version that is supplied with Windows XP.

Use A Local Style Sheet

Web pages use CSS to control how they look and feel. Many modern browsers allow the user to use apply their own style sheet to web pages, for example to make the font larger and easier to read. You can also create a style sheet that makes adverts invisible - this technique will not speed up your browsing experience, but it is effective at removing adverts.

For example if you are using Opera, try Jor's site for an exampe of this technique.

Wildcard Filtering

Out-of-the box Opera (6+) and Konqueror (3.5+) supports wildcard filtering and Firefox and Chrome/Chromium support filtering via the very popular and easy to use Adblock Plus extensions. These filtering tools can be easily configured to cut out most adverts, pop-ups, pop-unders, and other distractions. While the technology is slightly different, they can all use a similar list of filters, many of which can easily be found on the net with a Google search. In practice I have found you only need a few filters to cut down most of the adverts, and you only need to tweak the filters if you use a specific site that the common filters do not clean up.

To enable filtering in Opera versions 6.x - 10.x add the following line to your opera6.ini file in the [Adv User Prefs] section while Opera is not running:

URL Filter File=/path/to/filter.ini

Here is a sample of my filter.ini file:

; filter.ini
; This file is part of the Opera browser.

prioritize excludelist=1



For Mozilla based browsers (Mozilla, Firefox and Iceweasel) or Google Chrome/Chromium browsers install the Adblock Plus extension and add the same filters (as in the Opera example above) via the tool's easy to use interface. Additionally Adblock Plus supports "Regular Expressions". You can filter more adverts with fewer filters, in theory making mantainance easier and the filtering process faster.

Useful Links