Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Browser detection 1

Status
Not open for further replies.

TashaGoddard

Technical User
Jun 1, 2003
40
GB
I need to do the following browser detection:

if (browser = anything other than IE or IE < version 4) {
send to page X.html
}
else {
send to page Y.html
}

What's the easiest way to do this (if there is an easy way)?
 
how about:

Code:
var ie = document.all;
var ie4 = (ie && !document.getElementById);

if (!ie || ie4) {
	location.href = "pageX.html";
}
else {
	location.href = "pageY.html";
}

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Thank you! That seems to do the trick. I don't have multiple browser versions on hand to test it, but it goes to the correct pages for Netscape and for IE6, which is the main aim.

Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top