Kill/Block Ads Using Hosts File
October 4, 2007 at 8:00 am (General, Operating Systems, Tips n Tricks)
I know its annoying to face ads everywhere along the web pages. Here is a way to get par from it.
Hosts File: This is file which does the job of DNS for the host. example 127.0.0.1 is termed as localhost. This entry is there in the host file. You can find the host file at C:\WINDOWS\system32\drivers\etc\ This hosts file has an entry like
127.0.0.1 localhost
Online Ads : There are hardly any sites who place their own ads. Instead they take ads from a different ad server. The trick is to block the ip address of the ad server.
Trick : The trick is to make an entry of the ad server in the hosts file. And the ip corresponding to it will be the local loopback ip address. i.e. 127.0.0.1 Now, whenever request for the adserver is fired then the entry in the hosts file is checked first. Which checks loopback address(127.0.0.1 that return nothing).
Eg. I tried this for a site named http://www.vyomworld.com/
Watch out the ads on the top posted by google server. Right click on any of them and go for copy link option in the popup.
When pasted we get the link location as http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-4686307991865625&dt=1191484186718&lmt=1191484162&format=fp_al_lp&output=html&correlator=1191484186703&channel=0656107910&url=http%3A%2F%2Fwww.vyomworld.com%2F&cc=27&ga_vid=1692318819.1191484187&ga_sid=1191484187&ga_hid=1737865425&flash=0&u_h=600&u_w=800&u_ah=570&u_aw=800&u_cd=32&u_tz=330&u_his=1&u_java=true&u_nplug=14&u_nmime=52&kw_type=radlink&prev_fmts=728×15_0ads_al_s&rt=ChBHBJp5AA8pqAp6TA-renBrEgpTYW1wbGUgR1JFGggc7Nd7YCYnvCDm76gQKAFI5u-oEA&hl=en&kw0=Sample+GRE&kw1=Barron%27s+GRE&kw2=GRE+Application&kw3=GRE+Dates&kw4=GRE+Material&okw=Sample+GRE
So, make an entry in the hosts file and it looked as
127.0.0.1 localhost
127.0.0.1 pagead2.googlesyndication.com
Now, restart the browser and try the site again this is what I got..