Block Ads Without Using A Browser Plugin

by Rob on June 18, 2009

[ad#posts]

Stop seeing ads with the hosts file

Stop seeing ads with the hosts file

Firefox has a great plugin called Adblock Plus that stops you from seeing most advertising on the web.  But what about other browsers such as Opera, Epiphany or Konqueror?  Well, you don’t really even need a plugin to block some of those annoying ads that litter the web.

To block ads without a plugin you’ll need to edit your “hosts” file.  This file is probably located at etc/hosts and if you open this file up and insert a little bit of text you’ll magically make things disappear!

The basic format is to add the following to the hosts file:

127.0.0.1 somedomain.com

Don’t actually insert “somedomain.com”; the domain where the ad originates is what needs to be inserted there.

Most ads originate from some form of an ad server so putting in the domain name of this server will block your computer from seeing that content.  Both ads and websites will be blocked this way so be sure of what you enter in this file.

For example, let’s say you want to block seeing the Google Adsense ads that are on this site, as well as any other site.  You do this by entering this code into your hosts file:

127.0.0.1 pagead.googlesyndication.com
127.0.0.1 pagead1.googlesyndication.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1 pagead3.googlesyndication.com

By entering these 4 domains you will no longer see any Google Adsense ads on any browser that you use.

If you want to get really serious about blocking content this way, an extensive listing of ads and bad sites can be found here.  Add this to the end of your hosts file and you’ll be good to go.

I should mention that after editing your hosts file you’ll need to save it, restart your networking and refresh your browser to see the effects.  Then you’ll be able to surf the pages of Custom Distros ad-free.

Click some of these circles and spread the news!

Stumble thisDigg thisBookmark thisTweet thisPost on facebookSubmit to reddit

{ 2 comments… read them below or add one }

1 tricqster June 18, 2009 at 4:29 pm

great, thank you very much. :)

2 Brian Assaf July 3, 2009 at 11:12 am

One could also use privoxy
http://www.privoxy.org/

Works with any browser, easily customizable (to unblock any ads you do like to see), and included in the repositories of Ubuntu and other distros as it is Free Software.

Leave a Comment

Powered by WP Hashcash