Sent by Simon Willison on 28 July 2002 09:09
I have a site with Paul Sowden's styleswitcher, and I want to serve up a
very simple style sheet to Netscape 4 rather than using @import to hide
styles completely (I was doing this before but the site is for a University
music society and as such has a small but significant number of Netscape 4
visitors).
How can I do this in a way that doesn't affect my style switcher?
Here's the site:
www.nemeweb.com
My current solution is to serve up the NS4 sheet as the default, then use a
slightly modified style switcher to select one of the two alternative
styles for browsers that support style switching. This works fine for IE
and Mozilla but Opera ends up lumped with the NS4 stylesheet as it doesn't
support the DOM methdos used by the switcher. I've seen the backwards
compatible styleswitcher on ALA but I'd rather not use it as it doesn't
feature the instant change you get with Paul's method.
If there's no other way to achieve this I'm willing to resort to server
side browser sniffing to chuck an alternative style sheet at NS4 (I imagine
the user agent is pretty straight forward) but I'd rather use a client side
method, mainly as a learning excercise.
Regards,
Simon Willison
http://www.bath.ac.uk/~cs1spw/blog/