[thelist] Javascript - Browser detection

Bob Davis bobd at members.evolt.org
Mon Nov 20 09:42:17 CST 2000


on 11/20/00 3:27 AM, Zoe Oughton at zoe.oughton at btconnect.com wrote:

> I have a JavaScript which detects the users browser and incorporates
> different style sheets depending on the browser.
> The four different style sheets I have at the moment are for:
> Windows: Internet Explorer
> Windows: Netscape
> Mac: Internet Explorer
> Mac: Netscape
> 
> This has been fine so far, however with the new browsers, IE 5 and Netscape
> 6, I feel that I now need at least 2 other options for the Mac:
> Mac: Internet Explorer 5 and above
> Mac: Netscape 6 and above

I've been using a script from WebReference.com that is a derivative from the
Netscape Ultimate Browser Sniffer.

Here's what Netscape 6 (Mac) looks like to JavaScript:

Navigator Object Data
navigator.appCodeName: Mozilla
navigator.appName: Netscape
navigator.appVersion: 5.0 (Macintosh; en-US)
navigator.userAgent: Mozilla/5.0 (Macintosh; N; PPC; en-US; m18)
Gecko/20001108 Netscape6/6.0
navigator.platform: MacPPC
navigator.javaEnabled(): true

It announces itself as Netscape 5.  Interesting, no?

http://www.webreference.com/tools/browser/javascript.html

I modified mine a little to suit my particular needs, but it works very
well.

bob

-- 

bob davis
bobd at members.evolt.org





More information about the thelist mailing list