- Revealed at
- Up to date at
- Studying time
- 1min
It is speedy TIL time! Do you know the loading="lazy"
attribute does not work if you flip off JavaScript?
Now, you do. 😉
Why does not lazy load work with out JS? There’s just one motive why we won’t have good issues: in fact, it is for monitoring prevention.
Here is the loading
MDN documentation explaining the conduct:
Loading is barely deferred when JavaScript is enabled. That is an anti-tracking measure, as a result of if a person agent supported lazy loading when scripting is disabled, it could nonetheless be potential for a web site to trace a person’s approximate scroll place all through a session, by strategically inserting photos in a web page’s markup such {that a} server can monitor what number of photos are requested and when.
And in case you actually wish to get into this matter, here is the associated spec describing when loading="lazy"
ought to work.
And simply to be clear, as a result of some of us have been confused: photos will nonetheless load when JS is disabled. It is solely the deferred loading that will not work.
Associated Subjects
Associated Articles