[WEB4LIB] RE: Browser sniffing via javascript (was Draft home page not usable on my IE 6)

Raymond Wood raywood at magma.ca
Wed Jun 20 14:16:49 EDT 2001


On 20 Jun 2001, at 10:48, Thomas Dowling wrote:

> Before you write off comments about your page's rendering in IE6 as
> "whining" (a term I believe you used in another post), read up on its
> adoption of the questionable, but inevitable, practice of DOCTYPE

After reading this my brain responded with a lateral move  :)  and I 
remembered a question I've been meaning to ask this list for awhile.

Lately I have seen a lot of 'browser sniffing' being done via javascript 
on web pages.  It works like this:
1. javascript code is used to determine whether (for sake of 
argument) IE or Nav is being used.
2. separate stylesheets are employed (i.e. 1 for Nav, 1 for IE), and 
the appropriate stylesheet is invoked depending on the result of the 
browser sniff.

I find I am uncomfortable with this method in principle, for what if the 
user has javascript turned off?  Is there a better way to use 2 
stylesheets, each customized for a different browser, without having 
to rely on javascript?  Or, is it simply better to use one stylesheet for 
all browsers (I have noticed that the main difference between the 2 
stylesheets seems to be this - font sizes are expressed in 'pts' for 
Nav, and in '%' for IE).

I would be most interested in whatever best practices folks on this 
list might recommend in this case.

TIA,
Raymond
--
"Freedom is no longer available for free."
  (recent 'newspeak' from ZeroKnowledge Systems)


More information about the Web4lib mailing list