mozilla/bedrock — pull request #38 by jlongster (2012-03-28 05:07:09+00:00)
Title: optimize platform images

Here's a little nastiness required for our platform images. The goal is to show platform-specific images in screenshots (an OSX window when a user is on a mac, etc).

The problem: we've been downloading all 3 images (win, osx, linux) and showing the appropriate one with CSS. There are a few pages where this adds almost a megabyte to the page because there are so many images (/firefox/features). We need to optimize this.

What this does is to add a blank `` tag, and the javascript comes through and sets the appropriate `src` based on the user's platform. This means that only one image will be downloaded. Images will be displayed slightly later, but it's better than what we currently do on mozilla.org which is use `document.write`.

For people with js disabled, we also add an `` tag pointing to the windows version in a `