tags:

views:

35

answers:

2

Looking for some quick help to what is likely a well known problem.

I have two pages to access an application, one public with a log in box and one on our intranet with a auto authentication via network id. Our goal is to automatically connect to the page with the login box only IFF a user is not on the network (e.g. at home and not on VPN). What I'd like to do is use jquery to check if the auto authenticated page is available and if so use it, otherwise use the other page.

pseudo code:


on page load{
  if ( get http://autoautheticated.page status =! 404) 
  {
 document.location = http://autoautheticated.page
  }
  else
  {
 document.location = http://login.page
  } 
}

More - I don't have access to the target pages, and the launch page is static plain old html so javascript (jquery) seems to be a good fit for this problem.

+1  A: 

You can't do that, you can't check the HTTP header that sends the server via javascript.

You'll have to rely on ajax and PHP or a server-side language to do that.

metrobalderas
A: 

I've not tested this, but I think you can request the page using ajax and check the response code - if there's no errors and the status code is 200 then the page is accessible.

cmpscabral