This is implemented in Internet Explorer 11 (and maybe Edge) as
<img src="whatever.jpg" lazyload>
Which I believe was taken from the aforementioned (and dead, sadly) Resource Priorities spec. Sadly, the replacement, Resource Hints, has scaled back and is only about giving URLs to the lookahead preparser ahead of time.
Should the exact behavior be specifiable? Do you want to load images when the network is otherwise idle, or only once the image approaches the viewport? Something like lazyload="visible"
or lazyload="idle"
could work. Such behavior might require width
, height
, and sizes
attributes so the browser doesn’t have to reflow after fetching the image.
We have a few attributes already designed for loading and execution behavior. Maybe they should get expanded to all request-making elements, like:
<img async>
<link rel="stylesheet" defer>
<script lazyload>