Alternate Stylesheets

This issue was fixed in Internet Explorer 8 beta 2.

You may or may not be aware, but the majority of web pages on the Web are styled using at least a little CSS stylesheets. The stylesheets are usually shared across many pages, and help to create the theme. What you may not know is that it is possible to have more than one theme. You can use the link tag to not only specify the main stylesheets, but you can also specify alternate stylesheets.

Any good browser will show these stylesheets in the view menu (or equivalent), and allow you to select whichever one you want. Maybe one for accessibility, one for an alternative branding, one for ... well, you get the idea.

But not IE. Oh no. Of course not. In IE, we must use a script to reference all the style tags, concatenate with the list of link tags whose rel attributes contain the word 'stylesheet', collect them together, display a menu with a list of available style and link tag titles, and when one is clicked, cycle through the available stylesheets and if they match the chosen title, set the disabled property to false, and set it to true if they don't. Easy huh?

So what happens when script is disabled? Well, so is the ability to switch. But hang on. I said that you could use an accessibility stylesheet. But for accessibility, many disabled users are forced to disable JavaScript for other reasons. So to get the accessibility stylesheet, they have to enable something that causes accessibility problems. Hmmm.

Demo: If your browser is any good, it will enable you to choose an alternate stylesheet using one of its menus (usually the 'View' menu) - courtesy of dan1el.

Workaround: Use a stylesheet switching script and generate the menu to choose between them yourself. For an accessible alternative, you would have to allow them to choose styles using a server-side programming script, that dynamically generates the head section of every applicable page, with only the chosen stylesheet.

Don't click this link unless you want to be banned from our site.