srcset
polyfillThis is only showing a potential polyfill for srcset
attribute on img. It's only a quick proof of concept.
The minimum (and useful) code that should have a reasonable fallback story is:
<img style="display:none"
srcset="small.png 500w,
big.png">
<noscript><img src="small.png" alt="Alt here"></noscript>
Only set alt
on the img in <noscript>
, it'll be copied by the javascript out (if not, you'll get two alt texts if you have no javascript).
style
for Internet Explorer, it shows a broken image icon without (you may be okay with that, and can remove style if so).
View source to see the hacky javascript (which you could write into a nice polyfill).