4 ms·
> Some websites require JavaScript to display images nowadays. What's wrong with <img>? Because trifecta of retina (hi-dpi) displays, responsive design (use th
by mediumdeviation 10y ago
> Some websites require JavaScript to display images nowadays. What's wrong with <img>?
Because trifecta of retina (hi-dpi) displays, responsive design (use the same code for both mobile and desktop) and miserly bandwidth caps, (especially on mobile networks), means that traditional <img> tags won't do it any more.
<picture> is designed to help with this - and I'm pleasantly surprised to find that it has landed in a surprising number of browsers http://caniuse.com/#feat= http://caniuse.com/#feat= picture - but you'll still need a polyfill, which is if course JavaScript.
Pages with a lot of images also use lazy loading to reduce bandwidth usage even further.
Of course a <noscript> should be included, but it's getting harder and harder to make the claim that it is economical to support people without JS.