Writ­ten in 1998

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 DoubleClick’s merg­er with Aba­cus Direct last year.

ZDNet has done sev­er­al arti­cles on the top­ic, like Are Ban­ner Ads’ Ban­ner Days Over? and Singing the Ban­ner Blues. 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 were there are good points on both sides—advertising 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 offen­sive — espe­cial­ly 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). Inter­net Junk­busters has a great list of fil­ter­ing options—some, like their own Inter­net Junk­buster Proxy, are free, and oth­ers are share­ware or com­mer­cial prod­ucts.

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 doesn’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, doesn’t find the file, and gives you a lit­tle bro­ken image icon.

The hosts file wasn’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.

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. It varies depend­ing on your TCP stack. I found some infor­ma­tion that should give you a start, in any case.

I believe Un*x machines use the file as hosts.txt but I’m not going to pre­sume to say—if you know enough to be run­ning your own Un*x box you know more than I do about it any­way.

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.