RossOlson.com

Error Pages: The 404 Experience

The JavaScript for the Error page is pretty simple and I have it listed here. If you have difficulty copying it off of this page, you can either open up the source code for this page and grab it or save the text file that is linked here. (Don't click on that link, just drag it to your desktop.)

<SCRIPT LANGUAGE="JavaScript1.2">
<!--

// Script by Ross Olson
// www.bad-seed.org/about/

// Written for For Placement Only
// http://www.powertalk.com/rosso/, July, 1999

	var str = location.href;
  
	if (str.search(/.html/i)) {
		location.href = str.replace(/.html/i, ".shtml");
	}

//-->
</SCRIPT>


<SCRIPT LANGUAGE="JavaScript">
<!--

// Script by Tomer Shiran, Doc JavaScript:
// www.webreference.com/js/

// Written for the Oregon Museum of Science and Industry
// http://www.omsi.edu, March 11, 1998

var str = location.href;
  
if (str.charAt(str.length - 1) != "/") {
	location.href = str.substring(0, str.lastIndexOf("/") + 1);
	}

//-->
</SCRIPT>

The scripts are pretty simple they just needs to be placed at the head of the HTML page, in between the the HEAD tags. To see the first script in action, try this link (note the incorrect filename extension) and see what happens. You should end up right back here. For an example of a page with the second script in use, take a look at this page (which I took with me after I left OMSI).

[an error occurred while processing this directive]


 
 

[ Read and write comments ]