Ability to disable images loading, to customise when they load with scripting #10080
Labels
addition/proposal
New features or enhancements
needs implementer interest
Moving the issue forward requires implementers to express interest
topic: img
What problem are you trying to solve?
Currently to defer an image from loading, one can use
loading=lazy
which has generally desirable heuristics, however issues like #10056 demonstrate a need for customisable heuristics for loading an image.Some use cases demonstrating this need:
What solutions exist today?
The classic way to do this is to omit
src
and instead usedata-src
; then have some scripting to remove effectively renamedata-src
back tosrc
to trigger loading. This is not a perfect solution though; it has some security implications as it increases the surface area for malicious actors to supply bad urls to be inadvertently loaded by a site.How would you solve it?
My proposal (subtly different from #10056, but with significant overlap) is to extend the
loading
attribute to supply anone
value. Any<img loading=none src=…>
or<iframe loading=none src=…>
would not load, prefetch, or resolve dns to the given src. This would allow pages to use scripting to wait for their ideal conditions to alter theloading
attribute to another value to another value, which may include being later than whatlazy
provides (use case: offering a “click to show image” on bandwidth constrained devices, or for images with content warnings).Anything else?
No response
The text was updated successfully, but these errors were encountered: