Our Blog about iOS Development and more

How to filter annoying ads

If you are (like me) tired of some sites pushing you annoying content that some times is even noisy, there is a solution.
I am going to show you a quick and easy way to prevent that from happening again. The trick is done in a similar way web filters like Websense or SurfControl operate but this time we are making the change directly in our machine.

For our example, I am removing the annoying video that pops up when browsing www.elmundo.es. This video only plays in the US but it is annoying enough that I wanted to remove it forever from showing up.

Here are the steps I followed:


There are different ways to view what’s going on inside a web page, I used HTTPFOX, a plugin for FIREFOX that tells you what it is loading in the page. The idea is to know exactly where the undesired content is coming from.

HTTFox session running inside Mozilla Firefox searching for video content

On this case we found multimedia content coming from vindicoast.edgesuite.net as a video with extension flv. I don’t normally browse that site, and the ads that I have seen from it are not very interesting so I will go ahead and completely block vindicoast.edgesuite.net and to make sure there are no other subdomains, I will also block edgesuite.net.

2. Edit the HOSTS file on your computer

The HOSTS file is a delicate file so be careful how you make the edition. My recommendation is to make a copy of the original file before making any changes. This file is similar to a local DNS and takes precedence over the Internet DNS. So any changes you make in here will affect your whole system and all your installed browsers.

On a Windows computer:

  • Open a command prompt or browse with your Windows Explorer to C:/WINDOWS/SYSTEM32/DRIVERS/ETC
Locating the HOSTS file on a windows machine inside the system32/drivers/etc folder
  • Open the file HOSTS with your notepad
How to open the hosts file with your notepad in windows
  • Add an entry to redirect the undesired URL to
Adding entries to the host file using the notepad
For elmundo.es add also the following entries: ads.batanga.bz batanga.bz batanga.com

On a Mac computer:
  • Open a terminal window. You can do that from SpotlightSpotlight opening a Terminal on a Mac OS X running Mountain Lion or Snow Leopard
  • Execute sudo vi /etc/hosts in order to edit the file
Execute sudo vi /etc/hosts
  • If you don’t know VI this could be a little tricky. Basically you need to move with the arrow keys to the last line you have and click I to insert into the file. Then make it look like this one.
Editing Hosts file in Mac OS X
For elmundo.es add also the following entries: ads.batanga.bz batanga.bz batanga.com

  • When you are done click ESC in order to exit INSERT mode
  • Now you type :wq! in order to exit saving the file
How to save a file when editing with VI
  • And just with this your annoying ad is gone.
If you want to reverse the change you just need to remove the added entries to the host file and you are done. As mentioned, be careful when editing this file as you could potentially break something in your system. Do not erase or change anything that was already added to it.
Also, note that sometimes Windows will not let you edit that file unless you start notepad as an administrator. If you need to do that please refer to this document:


Comments are closed

Contact Us:

80 SW 8th street Suite 2802
Miami, FL 33130


SOFTBOLT - Miami, FL | Copyright ©2012. All Rights Reserved.