Skip to main content


11-11-14 Adam Simpson

The web is all about responsible compromises, and srcset embodies that mentality completely. Adam explores some recent project requirements that made srcset a handy solution.

On a recent project, I was faced with the situation of re-evaluating our typical approach to high-resolution images. In the past, we’ve used the Picturefill v1 JavaScript library to serve resolution-specific images to the correct devices. Things have changed since Chrome implemented the picture element and Picturefill v2 was released.

If we wanted to support scenarios without JavaScript (which we do) and IE 8 (I guess) and be in a good place for the future, we couldn’t jump on Picturefill v2 without some serious thought. In fairness to Scott and the Filament Group, all these issues are present in the Picturefill docs. So I started thinking about this project’s specific requirements and what options I had at my disposal.

Project Requirements

This particular project didn’t require any art direction (e.g. providing alternate croppings at different viewports), which is a big component of Picturefill and the picture element. Our only goal was to reliably provide high-resolution images to devices that had a high-resolution screen. Srcset provides a simple, straightforward way to serve up the proper assets to high-resolution devices. The best part of srcset is that it falls back to a normal image if the browser doesn’t support the syntax, and support is only going to get better. For a deeper dive on srcset and Picturefill, check out Jason Grigsby’s post over on the Cloud Four blog.

The Responsible Compromise

So, without using any JavaScript (yay!), we were able to serve a high-resolution image to the appropriate devices and also leverage the browser’s cache and potentially other implementation advantages (e.g. only load 2x on WiFi, 1x on 3G) in the future. Now browser support of srcset still has a ways to go (looking at you, IE and Android). However, iOS 8 brings support for srcset, and Chrome and Safari already support it on the desktop.

Srcset was the perfect fit given the project’s requirements because it provided a competent fallback (worst case is that 2x devices get a 1x image) for when it wasn’t supported and entirely removed a JavaScript dependency (always a good thing). The web is all about responsible compromises, and srcset embodies that mentality completely.

Related Content

User-Centered Thinking: 7 Things to Consider and a Free Guide

Want the benefits of UX but not sure where to start? Grab our guide to evaluate your needs, earn buy-in, and get hiring tips.

More Details

See Everything In

Want to talk about how we can work together?

Katie can help

A portrait of Vice President of Business Development, Katie Jennings.

Katie Jennings

Vice President of Business Development