It could then check what cookie the user had set and just pipe the correct stylesheet through.
Tested it and it worked just fine in Opera7 and IE6. But I couldn't get it to work on NN7. A little further investigation reveals that unless your external stylesheet ends with .css Netscape will simply ignore it.
This seems very wrong to me - I've already told it the mime type of the stylesheet (
type="text/css"), the file extension should be irrelevant.
Well, not only do you need text/css in the link to the style sheet, the server must transmit the page as text/css too.
There are two ways to solve the problem. Either, in your .htaccess file, add php as a text/css mime type. Or, better yet since it's a PHP file, make sure that it prints the text/css header before anything else.
The problem has nothing to do with the extension, just that NN7 doesn't receive a true text/css file :)
Of course now I'll expand it a bit so that it selects from a number of different stylesheets based on a cookie setting. That way I can support multiple stylesheets without waiting for Netscape or IE to work properly with the <link rel="alternate stylesheet"> tag.
Plus it seems like a nicer way to handle browser specific sheets.