Blocking Sites

I recently received a request from an advertising company that thought that this site would make a good match to a lot of the advertisers that they had on their books. Their particular advertising doesn't interfere with the other advertising on the page (so they claimed) because all their code does is to convert some of the text content of the page itself into links that display ads when clicked on.

While this concept looked like a good way of making advertising less obtrusive their way of creating the links involved adding a huge javascript to the bottom of the web page. In many cases the addition of such a script would double the size of my web pages and result in significantly longer loading times. In any case Javascript code doesn't belong at that spot in the HTML and what's more the code only works in some browsers but the code gets downloaded regardless.

Unfortunately it appears that a lot of major web sites have decided to start using this advertising with the result that their already huge web pages are now even bigger. How, I wondered, can I get rid of this huge extra Javascript from their web pages which does nothing in my browser except make their pages slower to load.

It was at this point that I remembered the hosts file which you can use to speed up the access to sites you visit regularly by providing them with the IP address of the site and so avoiding the need for a domain name search. If a site moves to a different IP address then the entry in the hosts file no longer points to the site and you need to find where the site has moved to to update the entry to point to the new location.

The hosts file can also (perhaps not so obviously) function in reverse to stop your web browser from being able to locate a particular site and hence to avoid wasting time downloading huge files from that site that serve no purpose.

To achieve this all that we need to do is to examine the source code of the page to determine the domain name that the file is being retrieved from (eg. We then place an entry into the hosts file specifying an IP address of followed by this domain name. The IP address of always represents the computer it is actually on and so requests for files from that domain will never leave your computer.

Most firewall programs should also provide you with the option to block access to particular sites.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow