Javascript User Agent Detection

Thursday June 3rd, 1999

Eric Krock of Netscape wrote to me and asked that I make this request to mz's readers:

Apparently there are many people out there using User Agent detection scripts that not only fail to detect IE5 and Mozilla (what will be Communicator5), but fail to detect that scripts meant for IE4 and Nav4 would also work in the 5.0 browsers. Netscape has created a more up-to-date client sniffer, and is requesting that people mention it in the signature area of their email messages - sort of a grass-roots way of getting the message out that User Agent detection has to be updated. Here's the recommended message:

Is your JavaScript ready for Nav5 and IE5?
Get the latest JavaScript client sniffer at

I've enabled the link in the sig above solely so you can visit the page and see it for yourself...

#13 Re:Javascript User Agent Detection

by zontar

Friday June 4th, 1999 6:38 PM

You are replying to this message

Heheh, just thought I'd see if I could get a rise out of people. ;-)

Yes, I have read the linked page @ Yes, I realize there are times when object detection fails -- for instance, doesn't work correctly in NN2.X for Unix and Mac (but let's be honest here -- just how many of you still bother making that second call to the open() method to get around it? I'll bet there's not too many hands raised...), MSIE4.0/Mac doesn't support dynamic clipping of CSS layers, etc. There is also the problem of dealing with MSIE's "pretend" support of the plugins array -- for which, in the case of Flash, for instance, you wind up checking for the existence of several elements in the plugins array, and document.write()ing an EMBED tag into the page for MSIE. (Although, strictly speaking, that's still object detection rather than userAgent detection, n'est-ce pas?)

The point I was trying to make is that, IMNSHO, in many cases, object detection works just fine, and there are (& going to be) a lot of broken pages just because people detected specifically for MSIE4 instead of checking for document.all (I've hit several of them myself when using MSIE5). The document.images detection mentioned above is another case in point.

It just irks me to see people hollering about checking for every agent/version/platform under the sun in cases where it's not necessary, that's all. Almost as much as it irks me that people can't seem to see ahead far enough to use ">=" instead of "=". Believe me, I'm not knocking Netscape for trying to raise a little consciousness in this regard, and trying to avoid "This Netscape 5 is sure a crappy browser" when it's the fault of the aforementioned people who didn't bother to look ahead past the browser version they were using when they posted their pages...

Having susserated my little susseration, I will now slither back under the rock whence I came, that I might avoid the heat of further flames from the Mighty MozAdmin... <grin>