-
Notifications
You must be signed in to change notification settings - Fork 2.9k
A hint for lazy loading images #2534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't think the second value is necessary. If you want to handle the loading yourself, I would think you could just remove the lazy-loading attribute from the images, which would stop/prevent the browser from doing it. |
With the second value, the premature loading of images would still be prevented by default. Otherwise websites would have to insert the |
This is a dupe of https://www.w3.org/Bugs/Public/show_bug.cgi?id=17842. Normally I'd move Bugzilla bugs to GitHub (i.e. close that with status moved and redirect people to this thread). However, there is so much important context in that Bugzilla thread, I think people need to really go and read and digest all the history there, so I would prefer that it stay the primary source of discussion on this topic. |
Note that this later got forward-duped to #2806. |
Lazy loading images are increasingly common across websites. The methods currently used to achieve it rely on scripting and offer little control for the user and user agent to decide whether lazy loading is appropriate. In contexts where scripting is disabled or scrolling is not involved (such as when printing, see issue #2532) the user may not see any image.
I would like to suggest a way for websites to hint to a user agent that an image should be lazy loaded. This will allow the user agent to decide the appropriate behaviour for the context.
As a basic proposal, I'm imagining that this hint would be an attribute on the
<img>
element. It could have two values:src
attribute, allowing for the common pattern where a low quality image is replaced with a higher quality one.I believe that such a hint would help give control of the behaviour to the user, make it easier for web developers with knowledge of only HTML/CSS to implement lazy loading images, avoid potentially expensive scroll listeners and allow users to see images even where scripting is not available.
The text was updated successfully, but these errors were encountered: