HTML5 page resource preload (Link prefetch) feature speeds up page loading

Source: Internet
Author: User
Tags prefetch

What is page resource pre-load/Pre-read (Link prefetch)? An explanation from MDN:

Page Resource preloading (Link prefetch) is a technique provided by the browser to allow the browser to download or pre-read some document resources during idle time, and users will access these resources in the future. A Web page can set a series of pre-loading instructions to the browser, and when the browser loads the current page, it silently loads the specified documents in the background and stores them in the cache. When the user accesses these preloaded documents, the browser can be quickly extracted from the cache to the user.

In short, let the browser pre-load other resources (pages, pictures, videos, etc.) that the user is most likely to access after accessing the current page. And the method is super simple!

HTML5 page Resource pre-load (Link prefetch) notation
 <!--  preload entire page  -->  <  link  rel    href  = "http://www.webhek.com/misc/3d-album/"  />  <!--  preload a picture  -->  <  link  rel  = "prefetch"   href  = "http://www.webhek.com/wordpress/wp-content/uploads/2014/04/b-334x193.jpg"  />  

The HTML5 page resource preload/Pre-read (Link prefetch) feature is Link implemented by tags and is rel属性 specified as "prefetch", where the href属性 address of the resource to be loaded is specified. Firefox also provides an additional property support:

<rel= "prefetch alternate stylesheet"  title= "Designed for Mozilla"  href= "mozspecific.css"/><rel= " Next "  href=" 2.html "/>

Prefetch can also be used under the HTTPS protocol resource.

What happens when the page resource should be preloaded

What resources are loaded on your page, and when to load, it's entirely up to you. Here are some suggestions:

    • When the page has a similar service for slides, preload/pre-reads the next 1-3 pages and the previous 1-3 pages.
    • Pre-load images that are common to the entire site.
    • The next page of the search results on the pre-load site.
Disable page Resource preloading (Link prefetch)

Firefox has an option to disable any of the page resource preload (Link prefetch) features, which you can set:

User_pref ("Network.prefetch-next", false);
Page resource preload (Link prefetch) considerations

Here are some things to note about page resource preloading (Link prefetch):

    • Preload (Link prefetch) does not work across domains, including cross-domain pull cookies.
    • Pre-loading (Link prefetch) can contaminate your site's traffic statistics, because some pages that are preloaded to the browser may not actually be accessible to the user.
    • Firefox has been providing support for this pre-load (Link prefetch) technology since 2003.

Original

HTML5 page resource preload (Link prefetch) feature speeds up page loading

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.