I need a banner to display at full width across many screen sizes. To accomplish this, I have 4 versions of the banner image.
- [email protected] (2880x640)
- banner-long.jpg (1440x320)
- [email protected] (1440x640)
- banner-short.jpg (720x320)
I'm using the srcset attribute.
<img
src="/images/interface/banner-long.jpg"
srcset="/images/interface/[email protected] 2880w,
/images/interface/banner-long.jpg 1440w,
/images/interface/[email protected] 1439w,
/images/interface/banner-short.jpg 720w">
However, if I start with a wide browser so that the long version loads, and then shrink the width of the browser, the short version never loads because the long version is cached. The browser (Chrome) figures it's already download a higher-resolution version, so it doesn't bother loading the smaller version. However, the whole point of having a smaller version is that the aspect ratio is more suitable for mobile devices (i.e. the aspect ratio is smaller). I'd like to force the smaller image asset to load
Is there any way to do this?