[Javascript] RES: (no subject)

liorean liorean at gmail.com
Wed Aug 29 18:17:42 CDT 2007


On 29/08/2007, Hassan Schroeder <hassan at webtuitive.com> wrote:
> David Hucklesby wrote:
>
> >> var ie=(document.all);
>
> > Browser sniffing is far too fragile - I suggest you use object
> > detection instead.
>
> Uh, that *is* "object detection", is it not??

Nope. Object detection means you are detecting whether objects you can
use for different paths exist. But this is not used that way - sure,
it's still detecting whether objects exists, but not for the purpose
of choosing whether to use them or use another path. This is just
using detection of objects to try to determine which browser is
running, and then choosing path based on browser.

> The implied conclusion -- that only Internet Explorer will recognize
> document.all -- may be wrong, but that's not relevant to the method...

The important factor is usage, not method. You should detect which
code path to go based on whether the objects for that code path
exists, not depending on which browser you think the user is using.
-- 
David "liorean" Andersson



More information about the Javascript mailing list