[WEB4LIB] Browser sniffing

Thomas Dowling tdowling at ohiolink.edu
Fri Nov 17 09:35:25 EST 2000


----- Original Message -----
From: <Eric_Wees at pch.gc.ca>
To: "Multiple recipients of list" <web4lib at webjunction.org>
Sent: Friday, November 17, 2000 9:03 AM
Subject: [WEB4LIB] Browser sniffing


> Thomas Dowling and others have recently used this term and I imagine I
am not
> the only one relatively new to the field who is intrigued.  I assume
this refers
> to a downloaded page being able to detect what browser a client is using
of
> purposes of displaying differently or interacting differently?  Is this
> accomplished using JavaScript or some other means?  Thanks in advance
for the
> knowledge sharing!
>

Browser sniffing means comparable things in [at least] two contexts.

The first is server-side browser sniffing, which is attempting to
determine what browser a user has by examining the "User-Agent" header it
sends to the server.  A server-side script could then alter what it sends
based on what browser it thinks it's sending to.

The second is client-side browser sniffing, in which a client-side script
tries to determine what browser it's in, usually through examining the
Javascript navigator.userAgent object.  Again, the script usually
customizes what it does based on that information.

My problem with browser sniffing is that it often leads to laziness.
Rather than figure out a general solution that is browser-independent,
developers are encouraged to create as many ad hoc solutions as they think
will meet their needs, and this in turn usually leads to the "We support
BOTH browsers" development model.  In fact, using browser sniffing to
support exactly two browsers (NS4 and IE4/5) is so widely abused that
Opera 4 has a menu setting to say whether it should honestly tell servers
that it's Opera, fake like it's Netscape, or fake like it's IE; Lynx has
always had a command-line option to provide whatever string you want for
the user agent header.


Thomas Dowling
OhioLINK - Ohio Library and Information Network
tdowling at ohiolink.edu



More information about the Web4lib mailing list