Mobile app version of vmapp.org
Login or Join
Bryan171

: Stylesheet switches increase loadtime? 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.

@Bryan171

Posted in: #Css #WebDevelopment

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.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Bryan171

2 Comments

Sorted by latest first Latest Oldest Best

 

@Nimeshi995

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)

10% popularity Vote Up Vote Down


 

@Pope3001725

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme