Link prefetching


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.

Prefetching in HTML5

There are two W3C standards covering prefetching for HTML5:
HTML5 methods for prefetch hints:

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

Browser support

Historical

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 is common for website operators to use these requests outside of this constraint. Plain hyperlinks 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,, 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:
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.