[jQuery] jQuery Browser Detection
Brian.
Aren't there cases though where the browser tells you the incorrect string?
For example, I believe that older versions of IE for Mac said that they were
actually a different browser than they really were. The AOL browser also
does this same thing I think.
<!----------------//------
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
andy@icglink.com
615.370.1530 x737
--------------//--------->
-----Original Message-----
From: discuss-bounces@jquery.com [mailto:discuss-bounces@jquery.com]On
Behalf Of Brian Miller
Sent: Monday, October 09, 2006 11:12 AM
To: jQuery Discussion.
Subject: Re: [jQuery] jQuery Browser Detection
I'm inclined to disagree.
I believe that one should use object detection for cases in which they are
invoking that object for it's functionality. A prime example is the XHR
(although MS may be messing around with that in IE7).
But, if one is best served by simply knowing what browser we are dealing
with, one should absolutely use the user agent string. It's where the
browser vendor *tells you* what browser it is. Why hack around, when the
vendor is telling you what you need to know?
For example: you need to apply a hack to get around one of IE6's infamous
layout bugs, when dealing with a dynamic web application. Are you going
to test for XHR or window.clipboardData? No, you ask the browser what
browser it is. If it's IE6, (or IE 5.5 if the bug is there, too), code
for that instance. We should avoid being obtuse in our code.
Summary:
1. Use object detection to detect objects, when you don't have to care
what browser you're using, as long at the object exists and will do what
you want it to.
2. Use the user agent string when you're more interested in what browser
you're actually using (by name) than you are in whether or not that
browser has a specific object available.
- Brian