<link rel="dns-prefetch">
The rel="dns-prefetch" attribute for the <link> HTML element is a hint to the browser that the page or user is likely to request resources from another domain, so the browser should preemptively resolve DNS for the href value's domain. It is most useful when native HTML semantics or browser capabilities can replace custom implementation work.
Overview
The rel="dns-prefetch" attribute for the <link> HTML element is a hint to the browser that the page or user is likely to request resources from another domain, so the browser should preemptively resolve DNS for the href value's domain. It is most useful when native HTML semantics or browser capabilities can replace custom implementation work.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 46 | 79 | 127 | 5 | 46 | 26 | |
- This browser only partially implements this feature
- This feature was removed in a later browser version (127)
- Only HTTP pages were supported.
Syntax
<link rel="dns-prefetch" href="https://api.example.com">
<link rel="dns-prefetch" href="https://analytics.example.com"> Live demo
DNS prefetch purpose
Show how DNS prefetch resolves a hostname before the full request begins.
DNS prefetch vs preconnect
Contrast hostname lookup with the fuller connection warm-up of preconnect.
Use cases
Control document behavior
Use <link rel="dns-prefetch"> to influence loading, metadata, or script behavior at the document level.
Tune performance strategy
Apply <link rel="dns-prefetch"> when earlier resource hints or document settings improve startup or runtime behavior.
Cautions
- Test <link rel="dns-prefetch"> in your target browsers and input environments before depending on it as a primary behavior.
- Provide a fallback path or acceptable degradation strategy when support is still limited.
Accessibility
- Make sure <link rel="dns-prefetch"> supports the intended task without making the page harder to perceive, understand, or operate.
Related links
Powered by web-features