Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why loading attribute is not working in chrome?

I have replaced lazy loading with native chrome loading="lazy" attribute but it seems to be not working. I am using Chrome 76 latest version.

I checked my page speed in https://developers.google.com/speed/pagespeed/insights and it still shows to Defer offscreen images!

Not sure what exactly I have missed?

<img class="img-fluid" loading="lazy" src="my-image-path" />
<img class="img-fluid" loading="lazy" src="my-image-path" />
<img class="img-fluid" loading="lazy" src="my-image-path" />
<img class="img-fluid" loading="lazy" src="my-image-path" />
<img class="img-fluid" loading="lazy" src="my-image-path" />
like image 503
Iftikhar uddin Avatar asked Oct 20 '25 04:10

Iftikhar uddin


1 Answers

I answered a related question some time ago:

After some research I found that I was missing something on my images. Images should include dimension attributes

As mentioned here: https://web.dev/browser-level-image-lazy-loading/#images-should-include-dimension-attributes

While it's not necessary, it is desired or expected to specify the dimension attributes on your images because without dimensions specified, layout shifts can occur. Resulting in unexpected behavior.

The browser needs to know the dimensions of your images to reserve sufficient space on a page for them.

Related question: https://stackoverflow.com/a/64330480/10757314

like image 114
P0wersl4ve Avatar answered Oct 22 '25 19:10

P0wersl4ve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!