Menu Close

Filtering Banner Ads

Writ­ten in 1998
Ethernet cables

A year or two ago I got tired of wait­ing for all those annoy­ing (and often ani­mat­ed) graph­ics in ban­ner ads to load when I vis­it var­i­ous sites, so I start­ed fil­ter­ing them out using a .hosts file. Sev­er­al peo­ple asked me how to do it, and I soon got tired of send­ing instruc­tions via email so I wrote this arti­cle. Since its orig­i­nal pub­li­ca­tion, there has been a lot of pub­lic­i­ty on the issue, espe­cial­ly with the firestorm of con­tro­ver­sy over Dou­bleClick­’s merg­er with Aba­cus Direct. The Death of Ban­ner Ads by David Strom out­lines some of the argu­ments against the ads. 

This is one of those issues where there are good points on both sides. Adver­tis­ing rev­enue does help pay for a lot of the con­tent out there. Unfor­tu­nate­ly, the ads get fanci­er and more dis­tract­ing and add to your down­load time for every page. With high­er band­width con­nec­tions avail­able to most of us, that isn’t as impor­tant now as it was at one time, but it’s still annoy­ing. Also, because of track­ing car­ried out by com­pa­nies like Dou­bleClick through the use of ban­ner ads and cook­ies, there are pri­va­cy con­cerns that are very sig­nif­i­cant to some peo­ple. Also, the graph­ics and text in some ads are offensive—especially those that come up on Deja.com and oth­er search engines when you get search results that include any kind of adult con­tent (whether that’s what you were search­ing for or not).

If you decide you want to do so, there are many options avail­able for fil­ter­ing out web-based ads. I haven’t used any of them except Nor­ton Inter­net Secu­ri­ty, and it does that along with many oth­er things (they bought the prod­uct for­mer­ly known as AtGuard). 

Using a .hosts file is free and has the advan­tage of not using up much (if any­thing) in the way of sys­tem resources. The down­side is that you have to keep the file updat­ed man­u­al­ly, and some sites are now using JavaScript and oth­er tech­niques that get around the .hosts file. Also, it does­n’t catch the ban­ner ads at sites like ZDNet and Deja.com, and some ver­sions of Inter­net Explor­er will refuse to load any­thing on a page after it finds that it can’t load the ban­ner ad. 

If you want to try it any­way, though, here’s how you do it. On a Win­dows machine, you sim­ply make a plain text file called “hosts” (no file exten­sion) and stick it in your Win­dows direc­to­ry. In fact, if you look there now you’ll prob­a­bly find a file called hosts.sam–—a sam­ple hosts file that shows you how to cre­ate a real hosts file. 

How does this lit­tle text file affect your brows­ing? The stan­dard IP address for refer­ring to “this machine I’m on right now” (also called the “local­host”) is 127.0.0.1—any time a TCP appli­ca­tion sees that address, it looks on your local machine instead of any­where else for what­ev­er is sup­posed to be there. So in the hosts file, all the ban­ner ad servers I know of are list­ed as being at 127.0.0.1. Instead of going out, find­ing that serv­er, and down­load­ing the ad, your brows­er looks on your own machine, does­n’t find the file, and gives you a lit­tle bro­ken image icon. 

The hosts file was­n’t intend­ed for this kind of use, exactly—it’s nor­mal­ly used to cut down on local DNS traf­fic. You can stick oth­er domain names and their numer­ic address­es into the hosts file, if you want to save time in get­ting to them (skip­ping the DNS lookup step). For instance, www.technomom.com is also 38.209.52.245—I could stick that into my hosts file if I want­ed to do so. 

If you want to know more about TCP/IP and IP address­es and DNS and so on, check out TCP/IP Intro­duc­tion or TCP/IP Overview and His­to­ry.

I know you can use hosts files on Macs but I’m not going to try to explain it—my Mac knowl­edge is sim­ply too stale. I found some infor­ma­tion that should give you a good start, in any case. 

In any case, you can use my old hosts file as a start—just save it as a plain text file and put it in the prop­er place. It con­tains all the ban­ner ad servers I had found when I was using it. 

Pho­to by Jor­dan Har­ri­son on Unsplash