I have a very simple HTML page on our public website – direct.html. We also have a group policy that makes this page the default homepage for all of our users. The purpose of this page is to direct the user to either (1) the home page of our Intranet IF the computer is authenticated on our network, or 2) the splash page of our public website IF the computer is remote. In an ideal world, everyone would be connected to the network and we could simple set everyone’s homepage to the Intranet…. But then there are the 60% who use a laptop…. If we set them up to default to the Intranet, they would get a ‘page not Found’ error anytime they worked off the network.
The code below has been working fine, but along comes IE7…

As far as I can tell, there are new security restrictions against redirecting across domains.
Has anyone come up with an elegant answer to this problem?
<html>
<head>
<title>AutoDirect</title>
<script type="text/javascript">
function isUrlActive( strUrl )
{
var oHttp = null;
if ( window.XMLHttpRequest )
{
oHttp = new window.XMLHttpRequest();
}
else
{
if ( window.ActiveXObject )
{
oHttp = new window.ActiveXObject( "Microsoft.XMLHTTP" );
}
else
{
throw "UNSUPPORTED PLATFORM";
}
}
if ( !oHttp )
{
throw "ERROR";
}
oHttp.open( "HEAD", strUrl, true ); // true = async, false = sync
oHttp.onreadystatechange = function()
{
var bDummy = true;
if ( oHttp.readyState == 4 )
{
if ( oHttp.status == 200 )
{
window.location="REPLACE_WITH_URL_OF_INTERNAL_PAGE ";
}
else
{
window.location="http REPLACE_WITH_URL_OF_PUBLIC_PAGE ";
}
}
}
oHttp.send( null );
}
</script>
<script type="text/javascript">
function direct()
{
isUrlActive("REPLACE_WITH_URL_OF_INTERNAL_PAGE ");
}
</script>
</head>
<body onload="direct()">
</body>
</html>