Forcing Gzipped content

30 September 2010

What would happen if every time you served a CSS or JavaScript file from your server you sent it Gzipped? Ignore whether the browser thinks it can handle compressed content, just send it compressed anyway.

Steve Souders talks about forcing Gzip compression at Google here, and this method assumes there is a significant number of browsers that won't be able to compress it and will choke. It would be interesting to see Google's data on that.

What if you took the Google idea:

  1. For requests with missing or mangled Accept-Encoding headers, inspect the User-Agent to identify browsers that should understand gzip.
  2. Test their ability to decompress gzip.
  3. If successful, send them gzipped content!

And changed it to:

  1. Send them gzipped content!

Do we have any real-world data that tells us practically, how many browsers would not be able to deal with that, and what percentage of users would get a broken experience?

This came up because Simon Willison tweeted:

S3/CloudFront don't handle conditional gzip, at all? That's a pretty shocking omission. The workarounds are really ugly&hellpi;

Perhaps it is a pretty shocking omission, but plenty of people are serving compressed JS and CSS from Cloudfront, right? So is it as much of a deal-breaker as it might have been a few years ago?