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

Need code to detect Netscape 4 & Under and if so cause popup window.

Status
Not open for further replies.

egims

Technical User
Joined
Jun 5, 2001
Messages
96
Location
US
I need code to detect when the browser viewing a site is Netscape ver. 4 or under, and if so cause a popup window.

After that I will be able to figure out how to put a message in the popup. But the code must be specifically for those conditions, and I would need the complete code.

Thanks very much.
 
Not sure if you can detect the version but here is how you detect the type. maybe you can play with it and get it the way you want or someone else can asist

if (navigator.appName == "Netscape")
{
window.alert("You are running Netscape navigator!")
}
else
{
if (navigator.appName == "Microsoft Internet Explorer")
{
window.alert("You are running Microsoft Internet Explorer")
}
provide tools to let people become their best.
 
egims, look at the post above this one that dis replied to. With that you have everything you need to complete what you're loking to do with a if here and there and a alert or two provide tools to let people become their best.
 
Thank you for the code, but I'm afraid it will not meet my need. I specifically need a way to detect Netscape ver. 4 or under. I do not want a window opening for versions above Netscape four.

I would still welcome anyone who can supply code that will perform this task.
 
thread216-273778
this thread shows you the code to detect the version then all you need to do is create a new window after the criteria is met.
if browser == "" then
{whatever you need to do}

provide tools to let people become their best.
 
onpnt,

Thank you.

What code can I use to detect the specific version of netscape as being 4 or under without having a popup window for later versions?
 
I only had a few minutes but I wrote this real fast. should work to show you how to detect the browser and version. I simnple wrote the version or a message after criteria. all you really need to do is add the pop up window code to the statement after meeting the version needs.
hope that explains it a little more provide tools to let people become their best.
 
Code

<html>
<head>
<script language=&quot;javascript&quot;>{
var browser = &quot;MSIE&quot;;
var browserVersion = 0;
var findIndex;
browserVersion = navigator.userAgent;
findIndex = browserVersion.indexOf(browser) + 5;
browserVersion = parseInt (browserVersion.substring(findIndex,findIndex +1));

document.write(browserVersion);
}
//this is for netscape version detection

browserVersion = parseInt(navigator.appVersion.substring(0,1));
if (browserVersion <= 1) {
document.write(browserVersion);
}
else
{
if (browserVersion > 1) {
document.write(&quot;<BR>&quot;);
document.write(&quot;no need to do anything&quot;);
}
}


</script>
</head>
</html>

provide tools to let people become their best.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top