Optimizing data downloaded via 'link' media queries and asynchronous loading
Posted
by
adam-asdf
on Pro Webmasters
See other posts from Pro Webmasters
or by adam-asdf
Published on 2012-11-06T08:07:53Z
Indexed on
2012/11/06
17:23 UTC
Read the original article
Hit count: 284
I have a website that tries to make sensible use of media queries and avoid 'expensive' CSS for users of mobile devices. My eventual goal is to make it 'mobile-first' but for now, since it is based on Twitter Bootstrap it isn't.
I included some background images (Base64 encoded) and styles that would only apply to "full-size" browsers in a separate stylesheet loaded asynchronously via modernizr.load.
In Firefox (but not webkit browsers) it makes it so that if you navigate away from the homepage and then return, the content (specifically, all those extras) 'blinks' when it finishes loading...or maybe I should say reloading.
If, instead of using modernizr.load, I include that stylesheet via a link... in the head with a media query attribute will it prevent the data from being downloaded by non-matching browsers (mobile, based on screensize) that it is inapplicable to?
© Pro Webmasters or respective owner