首页 > 其他分享 >Priority Hints & fetchPriority property All In One

Priority Hints & fetchPriority property All In One

时间:2023-01-19 09:34:25浏览次数:53  
标签:Web img Priority https xgqfrms property fetchPriority developer

Priority Hints & fetchPriority property All In One

试验性功能 ⚠️

image

https://caniuse.com/?search=fetchPriority

Priority Hints

优先级 / 性能优化

https://web.dev/priority-hints/

supported elements: img (含 picture ), link, script and iframe

image

image

https://wicg.github.io/priority-hints/#img

fetchPriority APIs

const img = new Image();
img.fetchPriority = 'high';
img.src = 'img/logo.png';

https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/fetchPriority

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-fetchpriority

demos

img height

/* height 无单位 */ 

<img src="/i/l/?n=20&i=blog/740516/202010/740516-20201020150243125-1990361642.png" height="400">

// 或

/* style height 有单位 */ 
      
<img src="/i/l/?n=20&i=blog/740516/202010/740516-20201020150243125-1990361642.png" style="height: 400px">

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-height

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading

(

标签:Web,img,Priority,https,xgqfrms,property,fetchPriority,developer
From: https://www.cnblogs.com/xgqfrms/p/17061059.html

相关文章