Suvarna Garge (Editor)

Link prefetching

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

Link prefetching is a method for web pages to declare hints allowing web browsers to pre-load various external resources to speed up loading and rendering of the page. The resources can include JavaScript, CSS, image, audio, video or web font files as well as DNS names and TCP connections.

Contents

HTML5 prefetching

Below are various methods that enable different types of link prefetching in supported browsers using HTML5 markup language to display a given link:

  • Standard link prefetching (executed by most modern browsers):<link rel="prefetch" href="http://www.example.com/">
  • DNS prefetching (Mozilla Firefox, Google Chrome, and others):<link rel="dns-prefetch" href="http://example.com/">
  • Prerendering (Google Chrome, Internet Explorer and others):<link rel="prerender" href="/page/to/prerender">
  • Lazy-load (Images) (Internet Explorer):<img src="image.jpg" lazyload>
  • The prefetch hints can be also sent in Link HTTP headers, for example:

    Link: <//pagead2.googlesyndication.com>; rel=dns-prefetch, </js/bootstrap.min.js>; as=script; rel=preload, </ads.html>; rel=prerender, </css/bootstrap.min.css>; as=style; rel=preload

    Two W3C standards discuss different forms of prefetch:

  • Link preload
  • explicit preloading of resources such as JavaScript, CSS, images and web fonts
  • Resource hints
  • less imperative hints for resources mentioned above as well as DNS name prefetching, TCP pre-connecting, page pre-rendering
  • Other prefetching

    It is possible for implementations to prefetch links even when they are not specified as prefetch links.

  • Fasterfox has an option to enable the prefetching of all page links by the browser.
  • Historical

  • iCab, Mozilla Application Suite, and WebTV are the first referenced browsers to support link prefetching.
  • Browsing using a Google Web Accelerator (discontinued product, may technically be called precaching)
  • The Blue Coat proxy appliance is known to use non‑compliant prefetching.
  • Modern browsers

  • Mozilla Firefox supports DNS prefetching, as of version 3.5.
  • Google Chrome supports prefetching of linked web content by "prerendering", as of version 11.
  • Internet Explorer supports prefetching of IP addresses by "DNS prefetching", as of version 9.
  • As of version 11, Internet Explorer supports the following set of features to expand its prefetching capabilities: "prerender", "dns-prefetch" and "lazyload" (images only).
  • Sites using prefetching

  • Google is the most well-known website that takes advantage of this feature so as to improve the user experience. If the first hit is considered very probable to be the desired hit, it is assigned as a prefetchable link.
  • Specifically, Google implemented "Google Instant Pages" in August 2011 which takes advantage of the aforementioned feature, predictive search completion, and preloading search results as the user types in order to improve the performance of the search engine.
  • Bing has employed the use of prefetching and preloading since the release of Internet Explorer 11 (October, 2013).
  • Issues and criticisms

    An issue inherent to indiscriminate link prefetching involves the misuse of "safe" HTTP methods. The HTTP GET and HEAD requests are said to be "safe", i.e., a user agent that issues one of these requests should expect that the request results in no change on the recipient server. However, it's not uncommon for website operators to use these requests outside of this constraint. Plain hyperlinks (which almost universally result in GET requests) are often used to implement logout functionality and account verification, e.g., when a user completes an account creation form, and an automated service sends a verification e-mail to the user's given e-mail address. Similarly, it is entirely possible for a hosting service to provide a Web front end to manage files, including links that delete one or more files. Users who visit pages containing these types of links, (whilst using a browser which employs an indiscriminate link prefetcher), might find that they have been logged out or that their files have been deleted.

    Additionally, there are a number of criticisms regarding the privacy and resource usage implications of link prefetching:

  • Users and website operators who pay for the amount of bandwidth they use find themselves paying for traffic for pages the user might not actually visit, and advertisers might pay for viewed ads on sites that are never visited.
  • Web statistics such as browser usage, search engine referers, and page hits may become less reliable due to registering page hits that were never seen by the user.
  • Users may be exposed to more security risks by downloading more pages, or from un-requested sites (additionally compounded as drive-by downloads become more advanced and diverse).
  • Users may violate acceptable-use policies of their network or organisation if prefetching accesses unauthorised content.
  • In the case of mobile devices or for users with a limited bandwidth allowance, prefetching may result in an unnecessary costly drain on limited bandwidth.

    In the case of prerendering, Google warns that improper use may result in the aforementioned increased bandwidth usage, slower loading of other links, and slightly stale content.

    References

    Link prefetching Wikipedia