Previous Message
Next Message

Pros and Cons of JavaScript vs. @Import

Sent by Dean Matsueda on 6 August 2004 20:08


>  
> Without getting into a discussion about which is better, could I get
> some "real world" Pros and Cons about using @import rather 
> than serving
> up separate stylesheets based on detecting the browser with 
> Javascript?
> That way I can make an informed decision on which route would be the
> best for us to use.

I never use Javascript/ECMAScript for browser detection because it just isn't bullet-proof.  As you
know, user's can turn it off and some browsers, like Safari, can send a user-agent string to make
your script think it's an MSIE 6 browser.  There's too many holes in this method for my comfort.

The only time I use the @import declaration is to hide a stylesheet from Netscape 4.x.  But to be
honest, I really don't do that anymore.  For earlier browsers, I just don't worry about
presentation... I just try to make sure that page content is accessible and readable as best as I
can to users of these browsers.

Otherwise, to target (or to hide) style declarations, I rely on hacks.

Perhaps I'm being lazy, but I've found that minimizing the number of stylesheets and relying on
hacks to be the simplest way.  Not saying this is the best way but this is what I do in the real
world.

HTH,
...dean
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: