There are many browser specific plug-ins (eg. Adblock Plus) available to block ads while browsing. If you want a tool compatible for all browsers, then you should try Privoxy.
Privoxy is a non-caching web proxy with advanced filtering capabilities for enhancing privacy, modifying web page data and HTTP headers, controlling access, and removing ads and other obnoxious Internet junk. Privoxy has a flexible configuration and can be customized to suit individual needs and tastes. It has application for both stand-alone systems and multi-user networks.
Install Privoxy on Ubuntu/Linux Mint/Debian
sk@sk:~$ sudo apt-get install privoxy
Install Privoxy on CentOS/RHEL/Scientific Linux
Privoxy will not be found in official repositories. So let us install EPEL repository:
[root@server ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Now install Privoxy using the following command:
[root@server ~]# yum install privoxy -y
Start Privoxy service
In Ubuntu/Linux Mint/Debian:
sk@sk:~$ sudo /etc/init.d/privoxy start
In CentOS/RHEL/Scientific Linux:
[root@server ~]# service privoxy start
Configure Web browser
Now open your web browser Proxy settings and set the proxy host as 127.0.0.1 and port number as 8118.
Test Privoxy
This is how my Yahoo home page looks before I enable Privoxy.
You can see the ads on left side of my Yahoo page. After enabling Privoxy, this is how my Yahoo page looks.
Now the ads are gone. That’s it.