seanpaul
07-16-2003, 02:41 PM
I have a script that checks to see your browser is above Navigator 6.0 or IE 5, if so, you are directed to the proper page, if not you are directed to an update page.
But the code redirects me to the update page even though I am using Netscape 7.0
Here's the code
<head>
<title>The auto detect browser script</title>
</head>
<html>
<script language="JavaScript">
var browser=navigator.appName;
var version=navigator.appVersion;
// Load page according to browser
function loadPage() {
// find which browser it is
if (browser.indexOf("Netscape") >= 0) {
// find which version
if (version.indexOf("1.") >= 0) {
window.location="upgrade.html";
}
else if (version.indexOf("2.") >= 0) {
window.location="upgrade.html";
}
else if (version.indexOf("3.") >= 0) {
window.location="upgrade.html";
}
else if (version.indexOf("4.") >= 0) {
window.location="upgrade.html";
}
else if (version.indexOf("5.") >= 0) {
window.location="upgrade.html";
}
else {
window.location="SIMC2/HTML/index.html";
}
}
// find which browser it is
if (browser.indexOf("Microsoft") >= 0) {
// find which version
if (version.indexOf("1.") >= 0) {
window.location="upgrade.html";
}
else if (version.indexOf("1.") >= 0) {
window.location="upgrade.html";
}
else if (version.indexOf("3.") >= 0) {
window.location="upgrade.html";
}
else if (version.indexOf("4.") >= 0) {
window.location="upgrade.html";
}
else {
window.location="SIMC2/HTML/index.html";
}
}
}
// stop hiding -->
</script>
<body onLoad="loadPage();">
SIMC ::: checking browser type . . .
</body>
</head>
</html>
and what is ">="? Does that mena greater than or equal to? Maybe that's where the problem is?
thanks
But the code redirects me to the update page even though I am using Netscape 7.0
Here's the code
<head>
<title>The auto detect browser script</title>
</head>
<html>
<script language="JavaScript">
var browser=navigator.appName;
var version=navigator.appVersion;
// Load page according to browser
function loadPage() {
// find which browser it is
if (browser.indexOf("Netscape") >= 0) {
// find which version
if (version.indexOf("1.") >= 0) {
window.location="upgrade.html";
}
else if (version.indexOf("2.") >= 0) {
window.location="upgrade.html";
}
else if (version.indexOf("3.") >= 0) {
window.location="upgrade.html";
}
else if (version.indexOf("4.") >= 0) {
window.location="upgrade.html";
}
else if (version.indexOf("5.") >= 0) {
window.location="upgrade.html";
}
else {
window.location="SIMC2/HTML/index.html";
}
}
// find which browser it is
if (browser.indexOf("Microsoft") >= 0) {
// find which version
if (version.indexOf("1.") >= 0) {
window.location="upgrade.html";
}
else if (version.indexOf("1.") >= 0) {
window.location="upgrade.html";
}
else if (version.indexOf("3.") >= 0) {
window.location="upgrade.html";
}
else if (version.indexOf("4.") >= 0) {
window.location="upgrade.html";
}
else {
window.location="SIMC2/HTML/index.html";
}
}
}
// stop hiding -->
</script>
<body onLoad="loadPage();">
SIMC ::: checking browser type . . .
</body>
</head>
</html>
and what is ">="? Does that mena greater than or equal to? Maybe that's where the problem is?
thanks