Mobile app version of vmapp.org
Login or Join
Murphy175

: Optimizing data downloaded via 'link' media queries and asynchronous loading I have a website that tries to make sensible use of media queries and avoid 'expensive' CSS for users of mobile devices.

@Murphy175

Posted in: #Cache #Firefox #MediaQueries #Mobile

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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Murphy175

2 Comments

Sorted by latest first Latest Oldest Best

 

@Speyer207

Reset your browser then check properties. clear cache and cookies.

10% popularity Vote Up Vote Down


 

@Angie530

YOu are doing it correctly with the MediaQueries. You might want to use modernizer as fallback, and find a polyfill to add media query support to legacy browsers. One thing I would advise you on is not to break up your stylesheet into multiple files. (Mobile.css / 920.css / tablet.css). Its best just to have one big css file, and then the css media rules at the bottom. Look at twitter-responsive.css to get an idea of what i mean.

Also look at BootStrapCDN.com They combine bootstrap.css / bootstrap-responsive.css into one single download. This speeds things up. You should use BootrapCDN.com to serve twitter bootstrap. NetDNA is super fast, and reliable. It will save you some bandwidth fees too.

Then add your own Custom.css after bootstrap which includes your own customizations that override bootstrap.css. Here include all your customizations for responsive layouts.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme