Prefetch

Jump to:

 

Prefetching is when content is downloaded in the background, based on assumptions that the content will likely be requested, enabling the content to load instantly if and when the the user requests it. The content is downloaded and cached for anticipated future use without the user making an explicit request for it.

 

DNS Prefetching

Domain lookups can be slow, especially with network latency on mobile. Most relevant when there are a plethora of links to external websites that may be clicked on, like search engine results, DNS prefetching resolves domain names in advance thereby speeding up load times by reducing the time  associated with domain lookup at request time.

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

Prefetching  is a performance optimization technique that works by assuming which links the user is likely to click, then downloading the content of those links. If the user decides to click on one of the links, then the page will be rendered instantly as the content has already been downloaded.

The prefetch hints are sent in HTTP headers:

Link: ; rel=dns-prefetch,
      ; as=script; rel=preload,
      ; rel=prerender,
      ; as=style; rel=preload

Prefetch attribute value

Browsers will prefetch content when prefetch <link> tag directs it to, giving the developer control over what resources should be prefetched.

 <link rel="prefetch" href="https://www.example.com/solutions" />

See also

 

Document Tags and Contributors

Contributors to this page: estelle
Last updated by: estelle,