WebPagetest Forums

Full Version: With request for html page - send html AND css file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Rather than wait for the browser to grab the first 10 lines of the html, and then start downloading the css file - it would be faster for me to send the css file the instant the html file is requested.

Seems like there would be an apache directive for this sort of thing.

Any ideas how to do it?
Sure, it's called inline css :-)

Seriously, there's no push support in http. SPDY provides some support for hinting to the browser but the first 10 lines of HTML arrive in the first packet (certainly the first round trip) so you're not going to be able to get much faster than that.
Ok, inline css it is.

Shaved off 0.2 seconds. Thanks.
Just a quick comment, fairly obvious but worth keeping in mind: Whether in-lining CSS is a net win or not will depend on the user behavior. If the user looks at just 1-2 webpages, then inlining is faster because you save one HTTP request. If the user look as several pages, then external CSS is faster overall, because the external CSS is a separate document which will be cached by the browser (since you're of course serving your CSS with long cache headers).
I guess this is the reason that Google does inline CSS? To miss that extra request?
(01-03-2011 06:35 PM)Geebee Wrote: [ -> ]I guess this is the reason that Google does inline CSS? To miss that extra request?

Yes, it is. Smile
Reference URL's