Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Java screening for undesirable browsers with redirect

Avatar of sasnaktiv
sasnaktivFlag for United States of America asked on
JavaJavaScriptHTML
23 Comments1 Solution357 ViewsLast Modified:
Does anybody have any idea why the first one of these html pages fails and the second one functions properly? It's beyond me!

THE FIRST PAGE BELOW FAILS WHEN TRYING TO LIST 2 SPECIFIC BROWSERS.
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT language="JavaScript">
<!--
var browserName=navigator.appName;
if (browserName=="Netscape")
{
window.location="welcome.html";
}
else
{
 if (browserName=="Microsoft Internet Explorer")
 {
  window.location="undesirableBrowser.html";
 }

else
{
 if (browserName=="Chrome")
 {
  window.location="undesirableBrowser.html";
 }

 else
  {
   window.location="welcome.html";
   }
}
//-->
</SCRIPT>
<meta name="robots" content="NOINDEX,FOLLOW">
</HEAD>
<BODY>
</BODY>
</HTML>


THIS SECOND ONE FUNCTIONS PROPERLY WHEN ONLY ONE 'ELSE IF' STATEMENT IS USED.

<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT language="JavaScript">
<!--
var browserName=navigator.appName;
if (browserName=="Netscape")
{
window.location="welcome.html";
}
else
{
 if (browserName=="Microsoft Internet Explorer")
 {
  window.location="undesirableBrowser.html";
 }

 else
  {
   window.location="welcome.html";
   }
}
//-->
</SCRIPT>
<meta name="robots" content="NOINDEX,FOLLOW">
</HEAD>
<BODY>
</BODY>
</HTML>
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick BarryFlag of Australia imageJava Developer
Commented:
This problem has been solved!
Unlock 1 Answer and 23 Comments.
See Answers