Webmaster Forum

Sponsored Reviews   1,000 Directory Submissions   V7N Directory
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Reply
 
LinkBack Thread Tools Display Modes
Old 02-05-2007, 05:51 PM   #1 (permalink)
Inactive
 
Join Date: 02-05-07
Posts: 1
iTrader: 0 / 0%
Latest Blog:
None

dazedand is liked by many
Intranet Redirect

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>
dazedand is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Intranet: open local file in fullscreen mode fairyjo Coding Forum 6 09-11-2007 02:37 PM
301 redirect help!! offthedome Coding Forum 6 05-27-2007 10:13 PM
Capture referrer from intranet site imaginemn Coding Forum 2 04-26-2004 10:25 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 05:33 AM.
© Copyright 2008 V7 Inc