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

how to detect netscape 4 with user agent?

Status
Not open for further replies.

petey

Programmer
Mar 25, 2001
383
US
I'm trying to positively identify Netscape 4 (N4) browsers, not with JavaScript, but by reading the UA string on the server-side. I don't care about detecting any other browsers.

My method so far is to check if "Mozilla/4" begins the UA string and if so check for the presence of "MSIE" further along in the string. If "MSIE" is NOT present then it's a good chance that it's Netscape 4. I'd like to know if there's a better way to narrow it down. Any suggestions?

Thanks,
petey
 
Hi,

This is how you do it using SSI:

<!--#if expr=&quot;${HTTP_USER_AGENT} = /Mozilla\/4/&quot; -->
You are using Netscape Version 4
<!--#else -->
You are not using Netscape Version 4
<!--#endif -->

Hope this helps!
relax.gif

 
Hi Nate. what I'm really wondering is what is the 'anatomy' of Netscape 4's useragent string and how to recognize it beyond a doubt. For example, here's a few examples of useragent strings:

MSIE 6
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

MSIE 5
Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

Mozilla
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2.1) Gecko/20021130

Netscape 4
Mozilla/4.77 [en] (WinNT; U)


I want to recognize all possible variations of this pattern and not generate false positives. Does anybody know of variations on the above format, or a better way to recognize it?

Thanks,
petey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top