html5 application cache遇到的嚴重問題
來源:易賢網 閱讀:1868 次 日期:2016-08-01 15:45:11
溫馨提示:易賢網小編為您整理了“html5 application cache遇到的嚴重問題”,方便廣大網友查閱!

在我們的3G版網站的項目中使用了html5 application cache,將大部分圖片資源、js、css等靜態(tài)資源放在manifest文件中。

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

代碼如下:

NETWORK:*

也就是說,對于所有的動態(tài)頁面,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

更多信息請查看網頁制作
易賢網手機網站地址:html5 application cache遇到的嚴重問題
關于我們 | 聯(lián)系我們 | 人才招聘 | 網站聲明 | 網站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點

版權所有:易賢網