DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> HTML基礎知識 >> HTML5詳解 >> html5 application cache遇到的嚴重問題
html5 application cache遇到的嚴重問題
編輯:HTML5詳解     
在我們的3G版網站的項目中使用了Html5/">Html5 application cache,將大部分圖片資源、JS、CSS等靜態資源放在manifest文件中。 

沒想到上線第一天就遇到了嚴重問題:application cache會默認緩存當前頁面!!!就算我們有如下設置: 

復制代碼代碼如下:www.mb5u.com
NETWORK:* 

也就是說,對於所有的動態頁面,application cache會緩存起來,用戶怎麼刷新都是老的! 

而且手機浏覽器還很難清除掉,也不支持JS清除! 

花了一個上午,嘗試了很多辦法,查了很多資料,都沒能清除掉客戶端的緩存。一上午被用戶投訴慘了。 

最後還是萬能的stackoverflow救了我: 

Do not use appcache unless it is REALLY 100% EXACTLY WHAT YOU WANT TO DO 
Even if it IS 100% EXACTLY WHAT YOU WANT TO DO, *DO NOT* use appcache until you are 100% CERTAIN that you are not going to make a single change to that page (or any file that it links to) for a LONG time. 
Delete the manifest file from the server -- if the browser can't find the manifest file, then it will clear its cache... ...this will also turn caching off for everyone. 
Don't turn it on again until it's 100% CORRECT 
Dealing with appcache is miserable, often. 
解決辦法很簡單,在服務器端刪除掉manifest文件,並且慎用application cache 

當然,也有辦法是用application cache,同時能繞過自動緩存當前頁面的問題。那就是用iframe
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved