Link prefetching

From HandWiki

Link prefetching allows web browsers to pre-load resources. This speeds up both the loading and rendering of web pages. Prefetching was first introduced in HTML5. Prefetching is accomplished through hints in web pages. These hints are used by the browser to prefetch links. Resources which can be prefetched include: JavaScript, CSS, image, audio, video, and web fonts. DNS names and TCP connections can also be hinted for prefetching. [1][2]

Prefetching in HTML5

There are two W3C standards covering prefetching for HTML5:

  • Link preload[1]
  • Resource hints[2]
    • Hints to the browser. Common hints include DNS queries, opening TCP connections, and page pre-rendering.

HTML5 methods for prefetch hints:

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

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

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

Popular 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.[12]
  • Bing has employed the use of prefetching and preloading since the release of Internet Explorer 11 (October 2013).[6]

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 is common 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:

  • Cookies set or sent to third parties compromise Web privacy.
  • Enables essentially/borderline Zero-click attack malware installation via 0day merely because a malware-spreading link is prefetched.
  • 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.

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

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.0 1.1 "Preload". https://w3c.github.io/preload/. 
  2. 2.0 2.1 "Resource Hints". https://w3c.github.io/resource-hints/. 
  3. Nottingham, M. (2010). "Web Linking". RFC 5988 (IETF). doi:10.17487/RFC5988. https://tools.ietf.org/html/rfc5988. Retrieved 2016-03-19. 
  4. "Resource Hints (Example 6)". Resource Hints: W3C Working Draft. W3C. https://www.w3.org/TR/resource-hints/#fetching-the-resource-hint-link. Retrieved 2016-10-31. 
  5. 5.00 5.01 5.02 5.03 5.04 5.05 5.06 5.07 5.08 5.09 5.10 5.11 5.12 5.13 5.14 5.15 5.16 "Prebrowsing". Steve Souders. 2013-10-07. http://www.stevesouders.com/blog/2013/11/07/prebrowsing/. 
  6. 6.0 6.1 6.2 6.3 6.4 6.5 "Getting to the Content You Want, Faster in IE11". IEBlog, Microsoft. 2013-12-04. http://blogs.msdn.com/b/ie/archive/2013/12/04/getting-to-the-content-you-want-faster-in-ie11.aspx?Redirected=true. 
  7. "Bug 730101 - Implement prerendering in Firefox". Mozilla. 2014-10-18. https://bugzilla.mozilla.org/show_bug.cgi?id=730101. 
  8. Fisher, Darin; Saksena, Gagan. "Link Prefetching in Mozilla: A Server-Driven Approach". http://2003.iwcw.org/papers/fisher.pdf. Retrieved 2014-05-09. 
  9. "Controlling DNS prefetching". https://developer.mozilla.org/en-US/docs/Controlling_DNS_prefetching. Retrieved 2014-05-09. 
  10. 10.0 10.1 "Web Developer's Guide to Prerendering in Chrome". https://developers.google.com/chrome/whitepapers/prerender?csw=1. Retrieved 2014-05-09. 
  11. "Internet Explorer 9 Network Performance Improvements". http://blogs.msdn.com/b/ie/archive/2011/03/17/internet-explorer-9-network-performance-improvements.aspx. Retrieved 2014-05-09. 
  12. "About Google Instant". https://www.google.com/insidesearch/features/instant/about.html. Retrieved 2014-05-09. 
  13. Fielding, Roy; Gettys, Jim; Mogul, Jeffrey; Frystyk, Henrik; Masinter, Larry; Leach, Paul; Berners-Lee, Tim (June 1999), Hypertext Transfer Protocol—HTTP/1.1, Network Working Group, IETF, p. 50. sec. 9.1.1, doi:10.17487/RFC2616, RFC 2616, https://tools.ietf.org/html/rfc2616, retrieved 2009-12-16 
  14. various (2009). "Mouseover Prefetch?". Gervase Markham, MozillaZine. Archived from the original on 2009-05-31. https://web.archive.org/web/20090531005531/http://weblogs.mozillazine.org/gerv/archives/2009/05/mouseover_prefetch.html. Retrieved 2009-12-16. 

External links