Sam, if that's a problem with your user base, then there are issues that go beyond the technical. If my users were that hackish and black-hatted, I wouldn't be giving them any front-end code at all if I could avoid it. I mean, if people are technically savvy enough to change their user agent string, what stops them from overriding the functions that you provide, as well?
I say, we split the difference. Leave jquery's browser detection as is, and offer "jUntrustworthy" as a plugin, which overrides the original implementation with one that uses object detection. - Brian > On 09/10/06, Brian Miller <[EMAIL PROTECTED]> wrote: >> 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 >> > > So what do you do in the case when the user agent string has been > changed (all browser vendors allow it to be changed)? I just don't > completely trust what the user agent string returns. > > I am testing for objects, but these objects are unique to each > browser. You could say it is abusing the objects (i.e. not using them > for what they are intended for). > > There is no foolproof solution to browser detection though. > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/