0
votes

I heard that chrome has implemented native lazy-loading for "img" elements, and that firefox will soon follow suit.

The explanations I found for this tell that when you add an attribute loading="lazy" to the img element, it will only request the src url when the browser considers it "close" to the viewport, the definition of "close" depending on the actual available bandwidth.

My question is actually about memory consumption. After a lazy-loaded image is actually loaded, and it goes sufficiently far away of the viewport, will the browser release the memory, lazy-loading it again (presumably from the disk cache) when it is necessary?

1

1 Answers

1
votes

https://whatpr.org/html/3752/urls-and-fetching.html#lazy-loading-attribute

The attribute provides a hint to the user agent to aid in deciding whether to fetch a resource immediately or to defer fetching until the element will be viewable, according to the attribute's current state.

From my interpretation of the specs, the loading attribute only affects the initial request to the particular resource from the server. It does not determine how the resource is meant to be rendered.