Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it okay to use both fetchpriority="high" and loading="eager" in img tag?

Tags:

html

css

frontend

Is it okay to use both fetchpriority="high" and loading="eager" in img tag ?

  • fetchpriority attribute not supported in firefox browser.

  • If i used both, how the assets prefetching works... should it cause performance issues

like image 585
Sathik Basha Avatar asked Nov 04 '25 08:11

Sathik Basha


1 Answers

Yes

loading="eager" is the default loading behaviour of the browser -> web.dev - The loading attribute. So applying this to an image won't do anything.

The eager value is simply an instruction to load the image as usual, without delaying the load further if it is off-screen. It does not imply that the image is loaded any quicker than another image without the loading="eager" attribute.

fetchpriority="high" will make sure the image is downloaded sooner than it would normally be -> web.dev - Fetch Priority. So if you use this on your LCP (Largest Contentful Paint) you will improve the performance of the page.

like image 50
Jesper Ingels Avatar answered Nov 06 '25 23:11

Jesper Ingels



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!