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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

detect netscape 4.x

Status
Not open for further replies.

gameon

Programmer
Joined
Feb 23, 2001
Messages
325
Location
GB
Hi, I usually use:

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
fp=0;
if (navigator.appName.indexOf(&quot;Netscape&quot;) > -1){
fp=0
}
if (navigator.appName.indexOf(&quot;Microsoft&quot;) > -1){
fp=1;
}
if (fp == 1) {
document.write(collapse.divStart)
}
else{
document.write('')
}
</script>

to detect netscape. Now I only want to do something for netscape 4.x and 6 and something else for 7. Can I use a switch statement?

M@
 
Code:
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
fp=0;
if (navigator.appName.indexOf(&quot;Netscape&quot;) > -1 && (navigator.appVersion.indexOf(&quot;4&quot;) != -1 || navigator.appVersion.indexOf(&quot;6&quot;) != -1){
fp=0
}
if (navigator.appName.indexOf(&quot;Microsoft&quot;) > -1){
 fp=1;
}
else if (navigator.appName.indexOf(&quot;Netscape&quot;) != - 1 && navigator.appVersion.indexOf(&quot;7&quot;) != -1)
{
fp = 2;
}
if (fp == 1) {
document.write(collapse.divStart)
 }
else if (fp == 2)
{
document.write(&quot;stuff for Netscape 7&quot;);
}
else{
 document.write('')
}
</script>

hope it helps! &quot;Those who dare to fail miserably can achieve greatly.&quot; - Robert F. Kennedy
So true..
 
cheers mate, its helped loads....
 
youuuur welcome. &quot;Those who dare to fail miserably can achieve greatly.&quot; - Robert F. Kennedy
So true..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top