A BOZO FILTER for a Web page


There is no such thing as bad publicity

or so the common (commercially-driven) adage goes.
Yet, for some of us, an adage is not equivalent to a truism.


Introduction

The Web is so open that information made available to one group is immediately available to all, independent of its relevance to the broader community. And while few of us would choose to limit the access to information to those who are honestly interested, it remains that there are visitors who range from the uncouth to the predatory. Like the politician who occasionally experiences an unwelcome endorsement, there will be pages which receive visitors through unwelcome links. I will leave it to your imagination as to what sort of pages you might not appreciate posting links to your page.

The BOZO FILTER was created for the victims of such predatory pages. It enables you to specify a list of URLs from which you do not wish to receive visits. It is implemented in JavaScript and so only works against browsers which understand that language, but as that represents a growing number of the browsers, the filter should be fairly effective.


Demonstration

I created a page, called filter, which has a bozo filter installed which prevents this present page (which servers as the bozo page) from branching to it. You are kicked back here (with a message telling you what is happening), if you try to branch from here to the page, filter.

On the other hand, the page filter does not block the page called friend. So you can branch to filter from the page friend.

Try it and see the difference.


Implementation

It is easy to implement. Copy the script below and past it onto your own page. It should be placed between the line which says

</title>

and the one which says

</head>

Then edit the following lines:

  1. the one which specifies the number of URL bozos you wish to block,
    e.g., var numb =4
  2. the ones specifying the (absolute) URLs themselves,
    e.g., bozo[1] = "http:// ....".
    Add as many as you wish (incrementing the number), but make sure the total number is the same as the numb variable.


The Script

The script to be copied and pasted follows:


<script language="JavaScript"> // this BOZO filter was created by Alistair B. Fraser: abf1@psu.edu // Copyright is retained by Alistair B. Fraser, but you are free to use it to repel predators var caller = document.referrer // this discovers the calling page var msg1 = "The BOZO FILTER intercepted a request from\n\n" // these form the var msg2 = "\n\nand DENIED ACCESS." // message in the // alert window if (caller=="") { msg1 = "The BOZO FILTER intercepted a request which did not come from a page, " msg2 = "and DENIED ACCESS. \n\nYou must branch to here from a recognizable page." } var numb =5 // set value to the number of bozos listed below function Bozo(numb) { for (var i =1; i <= numb; i++) { this[i] = i } } bozo = new Bozo(numb) // List the URLs of as many bozos as you wish following // the format of those shown immediately below. // The (1st) empty URL blocks attempts to circumvent the filter by // accessing the page through the Open Location dialogue box. bozo[1] =""; bozo[2] = "http://mirsky.turnpike.net/wow/1996/Jan/Jan1296.html"; bozo[3] = "http://metro.turnpike.net/mirsky/1996/Jan/Jan1296.html"; bozo[4] = "http://mirsky.com/wow/1996/Jan/Jan1296.html"; bozo[5] = "http://www.primus.com/staff/paulp/useless/music.html"; for (var i in bozo) { if (bozo[i] == caller){ alert("\n"+msg1 + bozo[i] + msg2); //delete line to remove alert dialogue history.back(); break;} } </script>


 

Send any comments or suggestions to the author at:

Home | Alistair B. Fraser | alistair@fraser.cc