Postpone loading images without using JS

I want to postpone the loading of images in an HTML file until all other assets are loaded or for a certain amount of time. I would like to do this without JS.

I already use the pending image upload method that JS uses in our web application. However, the version of this application works without JS, and I would like to have the same functionality, if possible. I posted this in the hope that there might be some small well-known HTML5 attribute that I can use for this. Any workaround is appreciated.

Addiction load

If possible, it would be nice to split the image loading into blocks. I'm fine, even if it's just one block.

  • All HTML / CSS
  • Image block
  • Image block

Note. . I already considered having lazy loading only for the JS application and immediately uploaded the image for my pure HTML version ( as described here ), which is my spare.

+4
source share
1 answer

If you are targeting the Chrome browser, lazy loading of the original image is added to chromium, so you do not need to install any third-party library for this.

Using lazy loading of the original image, you should add the attribute loadingto the HTML tag imgas follows:

<img src="..." loading="lazy" width="200" height="200">

Also make sure you have the latest version of the Chrome browser installed.

: https://web.dev/native-lazy-loading#image-loading

, .

+2

Source: https://habr.com/ru/post/1627220/


All Articles