I am working on a major update of my grunt plugin for automated srcset
and sizes
creation and am confused by Chrome's behavior lately (I am using Chrome Version 46.0.2490.80 m on desktop). I checked Yoav Weiss' demo and noticed that Chrome is downloading two images when I resize the browser width down to 400px—hires and mobile.
The code used on the demo page looks like this:
<img src="yacht_race@fallback.jpg" srcset="
img/yacht_race@mobile.jpg 320w,
img/yacht_race@wide-mobile.jpg 480w,
img/yacht_race@tablet.jpg 768w,
img/yacht_race@desktop.jpg 1024w,
img/yacht_race@hires.jpg 1280w"
sizes="
(max-width: 20em) 30vw,
(max-width: 30em) 60vw,
(max-width: 40em) 90vw"
alt="A very exciting yacht race.">
The same happens on my personal blog where both the -large and -medium image are getting loaded.
I already had a twitter conversation with Yoav and he was not able to reproduce the scenario. Can anybody else out there reproduce that? Is it a browser bug? Do I have a basic misconception of responsive images in my head? Any advice is appreciated!