Panduan Resource Hints

How preload, preconnect, dns-prefetch, dan prefetch resource hints speed up halaman memuat dan meningkatkan Core Web Vitals, dan when untuk gunakan setiap one.

Pertama kali diterbitkan: 2 Jul 2026 · Terakhir diperbarui: 3 Agu 2026 · Advanced
Bahasa

Resource hints (dns-prefetch, preconnect, preload, prefetch) tell browser untuk melakukan network berfungsi — DNS lookups, connection setup, atau fetching — earlier daripada ini otherwise akan. dns-prefetch adalah cheapest (DNS hanya); preconnect melakukan full DNS+TCP+TLS handshake; preload adalah sebuah mandatory fetch untuk sebuah late-ditemukan resource saat ini halaman perlu (like sebuah LCP image atau sebuah font di CSS) — tetapi -nya default priority masih depends pada resource jenis, not automatically "high" _(terjemahan)_ “tinggi” (fetchpriority adalah sebuah separate hint untuk itu); prefetch adalah sebuah rendah-priority speculative fetch untuk sebuah future halaman. big failure mode adalah overuse — preload everything dan Anda've prioritized nothing. dan menjadi honest tentang SEO: per Gary Illyes (Feb 2026), ini hints don't help Googlebot crawl atau indeks faster; mereka nilai adalah entirely pada nyata-pengguna side, which flows ke Core Web Vitals, one dari several signals Google's peringkat sistem gunakan — baik scores don't guarantee top rankings.

TL;DR — main resource hints form sebuah spectrum dari browser cost: dns-prefetch (DNS lookup hanya) → preconnect (DNS + TCP + TLS) → preload (sebuah mandatory fetch dari sebuah spesifik, late-ditemukan resource) → prefetch (lowest-priority speculative fetch untuk sebuah future navigation). modulepreload adalah preload’s sibling untuk JS modules. preload adalah satu-satunya one browser adalah obligated untuk fetch — itu’s berbeda dari saying ini adalah automatically tinggi priority; default priority masih depends pada resource jenis, dan fetchpriority adalah sebuah separate hint untuk raising ini. as attribute adalah diperlukan pada preload; crossorigin adalah diperlukan untuk fonts dan lainnya anonymous-mode fetches, atau browser downloads resource twice. Overuse adalah dominant failure mode. dan per Gary Illyes (Feb 2026), none dari ini helps Googlebot — SEO nilai adalah entirely indirect, melalui Core Web Vitals, which adalah one dari several sinyal peringkat, not sebuah deterministic one.

Evidence for this claim Preload declares a resource needed for the current navigation and fetches it with the resource's destination semantics. Scope: Current official or standards documentation. Confidence: high · Verified: MDN: preload Evidence for this claim Preconnect asks the browser to establish an early connection to an origin and should be limited to important origins. Scope: Current official or standards documentation. Confidence: high · Verified: MDN: preconnect

sebuah spectrum dari browser “cost” (terjemahan) “cost”

cleanest mental model untuk resource hints adalah untuk line them up oleh how much berfungsi Anda’re asking browser untuk melakukan up front:

  1. dns-prefetch — resolve sebuah hostname untuk sebuah IP. Cheapest.
  2. preconnect — DNS lookup plus TCP handshake plus TLS negotiation untuk HTTPS. sebuah full open connection, ready untuk gunakan.
  3. preload — go actually fetch sebuah spesifik resource, now. browser harus process fetch, tetapi itu doesn’t automatically membuat ini tinggi priority — more pada itu below.
  4. modulepreload — preload’s sibling untuk JavaScript modules; fetches module ke browser’s module map menggunakan module-script aturan alih-alih sebuah generic fetch.
  5. prefetch — go fetch sebuah spesifik resource, tetapi di lowest priority, untuk sebuah halaman pengguna hasn’t navigated untuk yet.

mereka go di one dari two places: sebuah <link> element di <head>, atau sebuah HTTP Link respons header (more pada header path, dan 103 Early Hints, below). None dari ini adalah document-tingkat Speculation aturan API — itu’s sebuah separate mechanism untuk prerendering/prefetching whole navigations, covered di prefetch bagian below.

dns-prefetch

dns-prefetch performs hanya DNS lookup untuk sebuah cross-origin server ahead dari time — ini doesn’t open sebuah connection. itu membuat ini cheapest hint dan sebuah sensible default untuk banyak lower-priority ketiga-party domains sebuah halaman touches (analytics, tag managers, minor widgets). di my own Largest Contentful Paint guide I membuat practical poin itu “DNS-prefetch has better support than preconnect” (terjemahan) “DNS-prefetch memiliki better mendukung daripada preconnect” — so ini adalah juga sebuah reasonable fallback untuk browser where preconnect isn’t honored.

<link rel="dns-prefetch" href="https://analytics.example.com">

preconnect

preconnect goes further: ini opens whole connection — DNS, TCP, dan (untuk HTTPS) TLS handshake — so itu oleh time browser perlu resource, pipe adalah sudah warm. itu’s sebuah bigger win daripada dns-prefetch, tetapi ini adalah juga more expensive untuk browser, which adalah why ini comes dengan two penting caveats:

  • Reserve ini untuk Anda sebagian besar critical cross-origin connections. sebuah handful (Anda font host, Anda image CDN, sebuah critical script origin) — not everything. Google’s Lighthouse “Preconnect to required origins” (terjemahan) “Preconnect untuk diperlukan origins” audit dan web.dev both warn itu unnecessary preconnects delay lainnya penting berfungsi.
  • sebuah unused connection adalah wasted berfungsi. browser close sebuah connection itu isn’t digunakan di dalam tentang 10 seconds, so sebuah preconnect untuk something Anda tidak actually fetch soon hanya burns handshake capacity untuk nothing.

untuk fonts, preconnect perlu crossorigin attribute — fonts adalah selalu fetched di anonymous (CORS) mode, dan without ini browser opens sebuah kedua connection anyway, defeating poin.

<link rel="preconnect" href="https://fonts.example.com" crossorigin>

preload

preload adalah one browser adalah obligated untuk execute — jika ini processes tag, ini harus start fetch untuk sebuah resource saat ini halaman definitely perlu tetapi akan otherwise menemukan late. itu’s sebuah statement tentang when fetch starts, not automatically tentang priority: default priority sebuah preloaded resource gets masih depends pada resource jenis dan browser (web.dev adalah explicit itu images, misalnya, stay rendah priority oleh default bahkan when preloaded). jika Anda ingin actually raise sebuah resource’s priority, itu’s sebuah separate, explicit hint — fetchpriority — not something preload melakukan pada -nya own. classic candidates untuk preload:

  • Fonts referenced inside sebuah CSS file — browser doesn’t know font exists until ini downloads dan parses CSS, so preload surfaces ini earlier.
  • ** LCP (hero) image**, terutama one set via CSS atau srcset itu isn’t sebuah plain early <img> di HTML.
  • Critical, late-ditemukan JavaScript atau CSS.

Two attributes membuat atau break ini:

  • as adalah diperlukan. ini tells browser what jenis dari resource ini adalah so ini dapat assign right priority dan match cache entry. Omit ini dan browser treats permintaan like sebuah generic XHR — wrong priority, dan sering sebuah duplicate download.
  • crossorigin untuk fonts — sama aturan sebagai preconnect; miss ini dan font downloads twice.

More umumnya, sebuah preload hanya gets reused jika eventual permintaan matches ini: sama URL, sama as/destination, yang sama type atau media condition, matching crossorigin/credentials mode, dan — where mereka apply — matching integrity dan referrerpolicy. untuk sebuah responsive image preload, itu juga berarti menggunakan imagesrcset/imagesizes itu mirror srcset/sizes browser akan actually pick, not sebuah single unconditional fallback URL. Get apa pun dari ini out dari sync dan browser either dapat’t reuse preload (duplicate fetch) atau fetches wrong candidate.

untuk LCP image specifically, Google’s saat ini recommendation adalah untuk pair preload dengan fetchpriority="high" so fetch starts alongside stylesheet. ini adalah combo I describe di my LCP guide too — fetchpriority="high" gets image earliest, dan preloading adalah sebuah strong kedua signal, berguna because sebagai I note there, “Early Hints don’t work on all browsers, so you may also want to preload the image.” (terjemahan) “Early Hints don’t berfungsi pada semua browser, so Anda dapat juga ingin untuk preload image.”

<!-- LCP image -->
<link rel="preload" fetchpriority="high" as="image" href="/hero.webp" type="image/webp">

<!-- Font in CSS -->
<link rel="preload" as="font" type="font/woff2" href="/fonts/inter.woff2" crossorigin>

overuse warning applies hardest here: jika everything adalah preloaded di tinggi priority, effectively nothing adalah. web.dev adalah explicit itu excessive preloads cause bandwidth contention, dan ini hits hardest pada slow networks. Preload two atau three genuinely late-ditemukan, genuinely critical resources — no more.

modulepreload

modulepreload adalah preload’s counterpart untuk JavaScript modules. alih-alih sebuah generic resource fetch, ini menggunakan module-script fetch aturan dan puts hasil straight ke browser’s module map — so when module adalah later imported, browser sudah memiliki ini. Depending pada browser, ini dapat juga go ahead dan fetch module’s static imports. mendukung dan how deep itu dependency-fetching goes both vary oleh browser, so test actual perilaku alih-alih assuming ini matches preload.

<link rel="modulepreload" href="/js/app.module.js">

prefetch

prefetch adalah odd one out: ini adalah not tentang saat ini halaman di semua. ini adalah sebuah rendah-priority, speculative fetch untuk sebuah resource sebuah future navigation akan mungkin perlu — langkah berikutnya di sebuah checkout, artikel sebuah pengguna adalah tentang untuk click. Because ini runs di lowest priority, ini doesn’t steal bandwidth dari saat ini halaman’s critical resources, dan prefetched files land di HTTP cache (jika mereka’re cacheable) ready untuk next navigation.

trade-off: jika pengguna tidak pernah goes there, Anda’ve spent bytes untuk nothing — so apply ini thoughtfully dan hindari ini pada slow atau metered connections.

<link rel="prefetch" href="/checkout/step-2" as="document">

Looking forward, Speculation aturan API adalah modern successor untuk prefetch untuk predicting sama-situs navigations; web.dev notes ini handles cases plain prefetch dapat’t (like non-cacheable navigations) dan behaves more consistently di seluruh origins. prefetch remains berguna dan more broadly didukung di meantime.

Preload vs. prefetch vs. preconnect vs. dns-prefetch

HintWhat ini melakukanPrioritybrowser harus obey?Best untuk
dns-prefetchDNS lookup hanyaSuggestionbanyak lower-priority ketiga-party domains
preconnectDNS + TCP + TLS (full connection)SuggestionAnda few sebagian besar critical cross-origin origins
preloadFetch sebuah spesifik resourceResource/browser-dependent — not automatically tinggi; pair dengan fetchpriority untuk raise iniYes, jika processedLate-ditemukan critical resources pada ini halaman
modulepreloadFetch sebuah JS module ke module mapResource/browser-dependentYes, jika processedLate-ditemukan ES modules ini halaman perlu
prefetchFetch sebuah spesifik resource, lowest priorityLowestSuggestionResources untuk sebuah mungkin future navigation

Resource hints dan Core Web Vitals

Here’s bagian SEOs actually care tentang — which hint moves which metric:

  • dns-prefetch / preconnect shave connection latency, which menampilkan up sebagai sebuah faster start untuk memuat Anda critical resources — feeding LCP dan, sebelum ini, FCP.
  • preload acts pada LCP dan FCP sebagian besar directly oleh starting fetch dari LCP image atau sebuah render-critical font/stylesheet earlier.
  • prefetch doesn’t touch saat ini halaman’s Core Web Vitals di semua — ini improves next halaman’s LCP/FCP oleh having -nya resources sudah cached.

None dari ini directly affect INP atau CLS, though getting fonts di earlier (via preload) dapat indirectly reduce layout shift dari font swaps — itu’s really sebuah font memuat topic, dan render-blocking resources adalah sibling artikel pada fetch-order side dari yang sama masalah.

melakukan resource hints help Google crawl atau indeks my situs?

No — dan ini adalah single sebagian besar penting nuance untuk get right, because sebagian besar konten pada ini topic adalah vague tentang ini.

di sebuah February 2026 Search Off Record episode, Google’s Gary Illyes dijelaskan why Googlebot largely ignores ini hints: mereka solve browser dan network latency masalah itu Google’s own crawling infrastructure doesn’t memiliki. sebagai reported oleh mesin pencari Journal, Illyes said “it’s very helpful if you have like a crappy internet to do DNS Prefetching for example. In our case, we don’t need to because we can talk very fast to all the cascading DNS servers.” (terjemahan) “ini adalah very helpful jika Anda memiliki like sebuah crappy internet untuk melakukan DNS Prefetching misalnya. di kami case, kami don’t perlu untuk because kami dapat talk very fast untuk semua cascading DNS server.” Jump untuk quote He dibuat yang sama poin tentang preload — “Same with preload. If we are not synchronous then we don’t particularly need to look at preload.” (terjemahan) “sama dengan preload. jika kami adalah not synchronous lalu kami don’t particularly perlu untuk lihat preload.” Jump untuk quote

So correct causal chain adalah: resource hints → faster nyata-pengguna experience → better Core Web Vitals → one dari several signals Google’s peringkat sistem gunakan. Google’s own pengalaman halaman documentation adalah explicit itu there’s no single halaman-experience signal, itu Core Web Vitals adalah digunakan oleh peringkat sistem alongside others, dan itu baik CWV scores don’t guarantee sebuah top peringkat — relevance masih wins di atas pengalaman halaman. So ini adalah not nothing — tetapi resource hints adalah sebuah UX/performa tactic pertama, dan mereka SEO nilai adalah entirely downstream dan non-deterministic. Don’t sell them internally sebagai “this helps Google read the page.” (terjemahan) “ini helps Google read halaman.”

Bing, untuk what ini adalah worth, memiliki published no hint-spesifik guidance di semua — -nya webmaster guidance references situs speed generically. browser-tingkat benefits (faster memuat, better vitals) apply yang sama regardless dari mesin pencari, so there’s no separate “Bing angle” (terjemahan) “Bing angle” untuk mengoptimalkan untuk here.

Delivering hints di atas HTTP: tautan header dan 103 Early Hints

Resource hints don’t memiliki untuk live di Anda HTML. Anda dapat kirim them sebagai sebuah HTTP Link respons header — Link: </hero.webp>; rel=preload; as=image — which adalah how server- dan CDN-tingkat implementations berfungsi. paling interesting versi dari ini adalah 103 Early Hints: sebuah preliminary HTTP status itu lets sebuah edge (like Cloudflare) kirim cached preload/preconnect Link headers sebelum origin server memiliki bahkan finished generating full respons — giving browser sebuah head start pada connections dan fetches while ini waits. I cover 103 status itself di my HTTP kode status guide, where I describe ini sebagai letting Anda preload resources untuk help LCP untuk Core Web Vitals.

umum mistakes

  • Preloading too banyak resources — cardinal sin; ini membuat bandwidth contention dan dapat membuat halaman slower overall.
  • Preloading things browser sudah menemukan early — sebuah early <img> di HTML doesn’t perlu preloading; Anda’re hanya spending sebuah permintaan slot.
  • Missing as pada preload — wrong priority dan sering sebuah double download.
  • Missing crossorigin pada font preload/preconnect — sebuah mismatched cache entry berarti font downloads twice.
  • Stale, unused preconnect tags — left behind setelah Anda dihapus ketiga-party script mereka adalah untuk, holding connections open untuk 10 seconds sebelum browser gives up.
  • Ignoring cost beyond Anda own halaman — unused hints don’t hanya waste Anda own bandwidth; mereka consume sockets dan server/ketiga-party capacity, dan dns-prefetch/preconnect dapat reveal mungkin destinations untuk network observers. browser dapat juga ignore, cancel, atau limit hints di bawah Save-data, rendah-power, atau mendukung constraints — prefetch di particular adalah treated sebagai optional dan skipped untuk reduced-data pengguna, so don’t assume sebuah hint Anda shipped adalah actually running untuk setiap pengunjung.
Evidence for this claim Unused preconnects and fetch hints can consume sockets, bandwidth, CPU, memory and server/third-party capacity, reveal likely destinations or trigger privacy-sensitive network activity; browsers may ignore, cancel or limit hints under settings, support or data-saving constraints. Scope: future-resource speculation Confidence: high · Verified: Prefetching, prerendering, and service worker precaching

cara test dan audit

  • Lighthouse / PageSpeed Insights — “Preconnect to required origins” (terjemahan) “Preconnect untuk diperlukan origins” audit flags missing preconnects pada key permintaan; treat ini sebagai sebuah prompt untuk tambahkan sebuah targeted one, not untuk carpet-bomb.
  • Chrome DevTools → Network panel — Priority column menampilkan what browser actually prioritized, dan Anda dapat spot preloaded resources fetching twice ( as/crossorigin bugs).
  • periksa untuk unused preconnects — jika sebuah preconnected origin tidak pernah appears sebagai sebuah actual permintaan, hapus hint.

untuk metrics ini semua feed, see Core Web Vitals dan Largest Contentful Paint; web performa alat artikel covers pengukuran stack secara mendalam.

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin a quote first.