How to Block Ads : Tutorial

Ads take over entire screen when you visit a website and intrusively play music, alerting everyone around you that you've visited a website that is probably not work-related and may leave behind tracking cookies so they can monitor your internet surfing behavior.

How to avoid them?

Well there are many browser etensions and plug-ins that help you do that.

But to get it better here is a way to block ads long before they reach your browser, you just need to set up an IP-blocking list (the same technology your browser-based blocker is using) either on your PC or through your router.


On PC

You do the blocking at the OS level. This means altering a file known as the hosts file.

A hosts file contains mappings of IP addresses to host names. When your computer starts up it loads the hosts file into memory and checks with this file before sending requests on to a web server.

To create an ad blocker, you simply need to add some rules to your hosts file. (Doing this may disable some other functions of web pages, such as certain embedded videos that normally begin with an ad, etc.)

On Windows the host file lives here:
C:\WINDOWS\SYSTEM32\DRIVERS\ETC

Of course, figuring out where ads are served from is a cumbersome task, Fear not, others have already done the hard work for you. One of this is the MVPs.org hosts file, just copy the contents into your hosts file, save and enjoy your new ad-free web.

#-Link-Snipped-#


Using a router

An even more efficient way to block ads is at the router level. Install an ad-block script on your router, and any computer connected to your home network won't be served ads.

Understandably, most routers don't contain tools to block any sort of content (even ads) out of the box. However, open firmware tools, like DD-WRT or Tomato, make it simple to set up a network-wide ad blocking system.

Learn how to install these by related forums where users have already contributed their own scripts along with instructions on how to install them. Just download the scripts, copy them to your router and you're done.

For DD-WRT, check out this link which contains several scripts and links you can use with your DD-WRT firmware.

#-Link-Snipped-#

Replies

  • Prasad Ajinkya
    Prasad Ajinkya
    There is another way - Use firefox and use Ad-Block Plus add-on.
  • Manish Goyal
    Manish Goyal
    Thanks for information sarvesh
    actually these ads makes me sick many times
  • sarveshgupta
    sarveshgupta
    kidakaka
    There is another way - Use firefox and use Ad-Block Plus add-on.
    kidakaka,

    ya you are right and many people may know about this but regarding this tutorial - in the starting of the article itself i mentioned that the tutorial enables you to block the ads even before they reach your browser and if you want to disable them at browser stage you have the plug-ins or add-ons as you said
  • tashirosgt
    tashirosgt
    Linux users (and maybe Windows users too), be careful if you pick a name for the domain of your local network.

    A frequently used domain name in Linux documentation is "myhouse.org".

    However, if you use this name and mistype a URL in your browser (such as "crazzyengineers.com") your browser will search for both the name ("crazzyengineers.com") and also the name with your local domain name appended ("crazzyengineers.com.myhouse.org).

    The myhouse.org domain appears to be owned by an advertiser. You will get a page of ads instead of the "server not found" message that you expect.

    It wouldn't suprise me if advertisers also own some domains with "foo" and other names that frequently appear as examples in documentation.
  • tashirosgt
    tashirosgt
    Regard the AdBlock plus extension to Firefox and other browsers: When you install it, you might as well install the "Noscript" extension to block malware scripts from web pages. (Noscript has it's own website; it's not at the AdBlock Plus website.) After doing installing Noscript, you may have to direct Noscript to allow scripts from sites that you trust in order to enable all the features of those sites.
  • Prasad Ajinkya
    Prasad Ajinkya
    Nice tip Tashiro! Thanks.
  • safwan
    safwan
    good information sarvesh !! @ kidakaka thanks for AdBlock plus, and thanks tashirosgt for Noscript adins.
  • crazytalk
    crazytalk
    kidakaka
    There is another way - Use firefox and use Ad-Block Plus add-on.
    +1, then download filterset-G which have a lot of urls from where ads originate already there for you.

    Greasemonkey is handy for removing annoying ads from facebook. AdBlock Plus will do the same, but Greasemonkey can do extra stuff using scripts.
    Here's the How To link...
    Dance Party

You are reading an archived discussion.

Related Posts

Write a Program to check whether no is prime or not without using any /,% operator and If statement?
If anyone wants to share with us your lovely memories of 2009 then post it here
I hope most of you Guys have faced this attack many times but don't know about it ie phishing attack Phishing is a form of social engineering. Phishing attacks use...
Bangalore: Quit smoking and get a 10 percent hike in basic pay. That is the offer made by the head of a Bangalore based firm to coax his colleagues to...
Quick Heal CEan of the month December 2009 is... 😁CEan - Goyal420😁 ​ CEan Goyal420 joined CE in September 2009 and has been an exceptional contributor to CE. Goyal420 belongs...