Closed Thread Icon

Topic awaiting preservation: Problems with Explorer/Netscape Pages that link to <a href="https://ozoneasylum.com/backlink?for=7896" title="Pages that link to Topic awaiting preservation: Problems with Explorer/Netscape" rel="nofollow" >Topic awaiting preservation: Problems with Explorer/Netscape\

 
Author Thread
STAVRO 74
Obsessive-Compulsive (I) Inmate

From: SWEDEN
Insane since: Oct 2001

posted posted 10-22-2001 11:36

Can anybody help me with this javascript?

I need to add an extra if statement i Guess but
i dont know how to. I need to use three different
files 1 explorer 2 netscape 4.5 3 netscape 6

<script>
if (navigator.appName == "Netscape"){
window.location = "attention3.htm";

}


else{
}
</script>

<script language="JavaScript">
<!--
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW &#0124; &#0124; innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->




lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 10-22-2001 12:07

should be like that:

code:
<script>
if ((navigator.appName == "Netscape") && (parseFloat(navigator.appVersion)<=4.5) )
window.location = "attention3.htm"; // netscape 4.5.x and below
else if ((navigator.appName == "Netscape") && (parseFloat(navigator.appVersion)>=6) )
window.location = "attention1.htm"; // netscape 6 and up
else if (document.all)
window.location = "attention2.htm"; // Internet Explorer

</script>



STAVRO 74
Obsessive-Compulsive (I) Inmate

From: SWEDEN
Insane since: Oct 2001

posted posted 10-22-2001 12:57

Thanks Lebanon!

/STAVRO 74

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 10-22-2001 20:17

I have a small correction for Lallous' code from above... Since Nestcape 6 is the same thing as Mozilla, it should also match all Mozilla based browsers (Mozilla itself, Galeon, K-meleon, etc.) Oh, while we are at Netscape, I think that it should also match NN 4.7x. And the last thing, checking for availability of document.all will return true when viewing your page in Opera (more precisely when Opera runs in MSIE compatibility mode) and Opera is not IE, heh... So, "better" code (that does exactly that you wanted) would be this:

<script>
if (navigator.userAgent.indexOf("Gecko") >= 0) { // NN6 and all other Mozilla based browsers
&nbsp;&nbsp;&nbsp;&nbsp;window.location = "gecko.htm";
} else
if (navigator.appName == "Netscape") { // all NN browsers less than NN6
&nbsp;&nbsp;&nbsp;&nbsp;window.location = "nn4.htm";
} else
if ((navigator.userAgent.indexOf("MSIE") >= 0) && (navigator.userAgent.indexOf("Opera") < 0)) { // MSIE
&nbsp;&nbsp;&nbsp;&nbsp;window.location = "msie.htm";
}
</script>


« BackwardsOnwards »

Show Forum Drop Down Menu