文章標題寫,為Affiliate而生 其實是夸張寫法,
prerender / prefetch
其實是為了提升網(wǎng)頁加載速度而但是一直通過預(yù)加載來實現(xiàn),提升用戶感受的方式,例如用戶在首頁停留2s, 而這2s里面我們就已經(jīng)加載了一個用戶可能要打開的頁面,那么用戶打開的速度會非常快. 給用戶的感受也是極好的
HTML5 Prerender / Prefetch名詞解釋
prefetch usage:
It should be used for fetching and caching resources for later user navigation as per the official HTML5 spec (i.e. prefetching a css file to be used in a page which highly likely to be used by the user in his upcoming navigation). Supported in Chrome, Firefox & IE.
簡單說就是緩存下一個網(wǎng)頁的資源,是HTML5的新特性, 支持的瀏覽器有Chrome(13以后), Firefox, IE 11
prerender usage:
It should be used for prerendering a complete page that the user will highly likely navigate to it in his upcoming navigation (i.e. like prerendering the next article where it is highly likely that the user will click on “next article” button). Supported only in Chrome & IE.
Prerender是Google的一個發(fā)明,正在提升用戶減少用戶在加載時的等待, 通過最相近匹配原則來加載例如“下一頁”的文章., 例如最佳推薦,當用戶訪問A頁面的時候, 用戶最可能訪問的下一個頁面上B 那么就預(yù)加載B頁面, 以達到提升加載速度的效果, 支持的瀏覽器有Chrome , IE11
使用方法
is actually part of the HTML 5 spec. appears to be Google doing their own thing.
第一中方法是 將以上鏈接添加到xxx
第二種方法是 使用JS代碼注入方式;
var myHead = document.getElementsByTagName(‘head’)[0]; var myLink = document.createElement(‘link’); myLink.setAttribute(‘rel’, ‘prerender’); myLink.setAttribute(‘href’, ‘http://apple.com/ipad’); myHead.appendChild(myLink);
或者使用Jquery方法:
$(“head”).append(‘www.guoli.biz/’);
有什么問題,歡迎留言提問
【相關(guān)推薦】
1. 免費h5在線視頻教程
2. HTML5 完整版手冊
3. php.cn原創(chuàng)html5視頻教程