Example 10: Loading pages based on the URL

This behavior is useful when multiple sites are being served up by the same ip address



<html>
<head>
<script language="javascript">
<!--
function f_redirect(){
var url   = document.location ; //capture the contents of the browser location
var temp  = new String(url)   ; //convert the browser location to a string
var url2  = temp.toLowerCase(); //convert the browser location to lower case

//search the browser location
if (url2.indexOf("carsdirect.com") >= 0) {   // go to carsdirect
    top.location='carsdirect/index.html';
    }
else {
    top.location='index.html';
} 
}
//  -->
</script>
<title></title>
</head>
<body onload="f_redirect()" $formtype=this>

<h2>Loading</h2>
<em>Please wait ...</em>

</body>
</html>