I am using stylesheet switcher which uses a number of alternate stylesheets for the media="screen" and switches to those styles when instructed by the user.

But in the web page I have to use several http requests to link so many style sheets which increases the loadtime.

Is there anyway I can modify the code to load fast? How combining works I don't know since all style sheets are different.


Use JavaScript to add the <link> tags for each alternate stylesheet after the DOM has loaded. That way the page will load faster and while the user is looking at it, but before they have much of a chance to do anything the browser will load the alternate stylesheets in the background seamlessly.

  • Agree. Use javascript to attach and load the alternative stylesheets. – Rincewind42 Jul 18 '11 at 8:24

I don't know how you are including the alternate style-sheets, but a <link rel="alternate stylesheet" … /> will NOT be loaded by a browser automatically. Instead modern browsers like Opera or Firefox provide a menu-option, for allowing the user to switch to an alternate stylesheet. But that may also be spiced up using JavaScript. For example see "Alternative Style: Working With Alternate Style Sheets" (ALA, 2001)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.