Successfully Blocking Ads (at OS level)
To share back with community. If you never knew how to properly block advertisements stuffed into your face, there is very efficient way to block most of ads served online. It is not really blocking, more of a circumvention: by using DNS and built-in features of our own operating system, we can re-direct ad requests to the – null. How do we do this? (If you do not understand technical lingo, skip to the end of the article please).
We do it by filling in the information into our local hosts file. It is a file that our computer uses first when given domain name and is trying to determine IP address. In linux distros, it is stored often as /etc/hosts, while in windows it resides in windows folder – usually C:\Windows\system32\drivers\etc\hosts (or something like that, whatever is your windows folder). If you edit that file and insert other domain-address combinations, your computer will never look elsewhere to resolve listed domains into addresses. All you need is to insert a list of advertisement servers and link them to nothingness. This acts in such manner, that it confuses your computer out of its usual behavior: whenever you are served a web page (one you requested by typing its URL into your browser’s address bar), and such webpage contains embedded advertisement code (as 99% of the websites do), your computer is ALSO served content from such advertisement servers. Now, if we would have custom and complete (or almost complete) list of advertising server’s domains, we could redirect such traffic into null (or whatever). To do so, we follow those steps:
1. open http://www.mvps.org/winhelp2002/hosts.txt and save it to your desktop or wherever it is convenient for you. You will need contents of that file.
2. open your hosts file (c:\windows\system32\drivers\etc\hosts for windows, and /etc/hosts for linux) for editing. You will need administrative permissions to do so; in windows vista or 7, you might even need to reboot into the safe mode. In linux or older windows it is enough to have superuser permissions (such user is also called root or administrator, or super-administrator).
3. paste whatever you copied from hosts.txt file into your existing hosts file.
VoilĂ – you are surfing and there are no more gruesome advertisements, full page flashes, and other stupidities that were in your way while you were procrastinating. Also, remember that it might happen that some websites BLOCK access to users that block ads. If you wish, you can return to the previous state, when you were bugged, just erase whatever you pasted into hosts file (and perhaps restart your machine, if its running windows, i guess).