Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)75k · #2842

fetchpriority-attribute

Skill này làm gì

Skill này kiểm tra cách trang gợi ý mức ưu tiên tải cho các ảnh và tài nguyên chính. Skill dành cho lập trình viên muốn nội dung chính của trang hiện ra nhanh hơn.

Khi nào nên dùng

  • ✓Khi ảnh hero chính trên trang tải chậm.
  • ✓Khi trang của bạn có điểm kém về Largest Contentful Paint.
  • ✓Khi nhiều ảnh cùng tranh nhau tải ở phần đầu trang.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/fetchpriority-attribute/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/fetchpriority-attribute/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể bảo trình duyệt tải ảnh hero của tôi trước không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent tìm ảnh lớn nhất phía trên vùng nhìn đầu tiên và gợi ý một gợi ý ưu tiên cao cho nó. Agent cũng có thể gợi ý ưu tiên thấp hơn cho các ảnh nằm xa hơn ở phía dưới trang.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Use fetchpriority to hint resource loading priority

Browsers use internal heuristics to guess resource priority, but they cannot know which image is your LCP candidate. Adding fetchpriority="high" to the LCP image has been shown to reduce LCP by 5–30 % in real-world tests, directly improving Core Web Vitals scores and user-perceived load speed. The attribute costs nothing to add and is the lowest-effort high-impact performance optimisation available today.

Quick Reference

  • Add fetchpriority="high" to the LCP image to accelerate Largest Contentful Paint
  • Add fetchpriority="low" to below-the-fold images that would otherwise compete with critical resources
  • Use fetchpriority="high" on <link rel="preload"> for critical fonts and CSS
  • Avoid marking more than one or two resources as high priority — it defeats the purpose

Check

Check whether the LCP image or hero element has fetchpriority="high" and whether any high-priority preload links are missing the attribute.

Fix

Add fetchpriority="high" to the LCP image element and any preloaded critical resources, and fetchpriority="low" to non-critical below-the-fold images.

Explain

Explain how the browser's resource priority queue works and how fetchpriority hints change loading order to improve LCP.

Code Review

Review the HTML for images above the fold. Flag the LCP candidate if it lacks fetchpriority="high", and flag any carousel or below-fold images that lack fetchpriority="low" (they compete with critical resources).


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/performance/fetchpriority-attribute

Câu hỏi thường gặp

fetchpriority làm gì?

Đây là một thuộc tính HTML gợi ý mức độ quan trọng của một tài nguyên, để trình duyệt có thể tải theo thứ tự tốt hơn.

Nó giúp được bao nhiêu?

Skill dẫn các thử nghiệm thực tế cho thấy cải thiện khoảng 5 đến 30 phần trăm trên Largest Contentful Paint.

Mọi ảnh có nên có ưu tiên cao không?

Không. Skill cảnh báo rằng đánh dấu hơn một hoặc hai tài nguyên là ưu tiên cao sẽ làm mất ý nghĩa của nó.

Chi tiết

Mô tả gốc của tác giả

Use when optimising Largest Contentful Paint (LCP), reducing render-blocking resource contention, or fine-tuning resource loading order in the critical rendering path.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#2842
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự