Link prefetching

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.[1][2]

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:

The prefetch hints can be also sent in Link[3][4] 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:

Other prefetching

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

Browser support

Browser Prefetching Supported
Standard link prefetching DNS prefetching Prerendering Lazy-load (Images)
Android browser Yes[5] No[5] No[5] No
Chromium Yes[5] Yes[5] Yes[5] No
Google Chrome Yes[5] Yes[5] Yes[5] No
Internet Explorer Yes[6] Yes[6] Yes[6] Yes[6]
Mozilla Firefox Yes[5] Yes[5] No[7] No
Opera Yes[5] No[5] No[5] No
Safari No[5] Yes[5] No[5] No

Historical

Modern browsers

Sites using prefetching

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.[13] 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.[14]

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

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.[10]

See also

References

  1. 1 2 "Preload". w3c.github.io. Retrieved 2016-03-19.
  2. 1 2 "Resource Hints". w3c.github.io. Retrieved 2016-03-19.
  3. "Web Linking". RFC 5988. IETF. Retrieved 2016-03-19.
  4. "Resource Hints (Example 6)". Resource Hints: W3C Working Draft. W3C. Retrieved 2016-10-31.
  5. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 "Prebrowsing". Steve Souders. 2013-10-07.
  6. 1 2 3 4 5 6 "Getting to the Content You Want, Faster in IE11". IEBlog, Microsoft. 2013-12-04.
  7. "Bug 730101 - Implement prerendering in Firefox". Mozilla. 2014-10-18.
  8. Fisher, Darin; Saksena, Gagan. "Link Prefetching in Mozilla: A Server-Driven Approach" (PDF). Retrieved 2014-05-09.
  9. "Controlling DNS prefetching". Retrieved 2014-05-09.
  10. 1 2 "Web Developer's Guide to Prerendering in Chrome". Retrieved 2014-05-09.
  11. "Internet Explorer 9 Network Performance Improvements". Retrieved 2014-05-09.
  12. "About Google Instant". Retrieved 2014-05-09.
  13. Fielding, Roy; Gettys, Jim; Mogul, Jeffrey; Frystyk, Henrik; Masinter, Larry; Leach, Paul; Berners-Lee, Tim (June 1999). "Safe Methods". Hypertext Transfer Protocol—HTTP/1.1. Network Working Group. IETF. p. 50. sec. 9.1.1. RFC 2616. https://tools.ietf.org/html/rfc2616#section-9.1.1. Retrieved 2009-12-16.
  14. various (2009). "Mouseover Prefetch?". Gervase Markham, MozillaZine. Archived from the original on 2009-12-16. Retrieved 2009-12-16.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.