Friday, October 11, 2013

Why does Google serve all browser styles to all browsers?

Google has long been at the forefront of Web performance: serving a quality user experience with minimal loading time. And with their new flat logo, they're pushing even fewer bytes to the browser for their core search page. (That's because images with areas of flat color can be compressed much smaller than images with bevels and shadows.)

So, on a whim, I checked out the source code for, to see what else they're up to. The source is minified and therefore hard to read, but one thing jumped out at me and was a surprise: Internet Explorer-specific CSS. Of course, it makes sense that they provide styles for all browsers, but I'm using Chrome.

HTML source of, using Chrome browser
Now, before all you blog readers start a stampede (is there a word for a stampede of one?), I know it's standard practice to include all browser fallbacks in a site's master stylesheet. But, with a site at the scale of Google, and with Google's need for speed, I would expect them to read my user-agent request header and respond with only the styles that my browser will actually use.

I'm sure there's a good reason -- probably, the overhead of browser sniffing outweighs the benefit of trimming unused styles. Just curious.