Web移動端使用localStorage緩存Js和css文件 | 強制不要緩存

1.儘可能不把js放在onload事件中,而是放在由用戶主動觸發的事件
2.加時間戳,時間不一樣則會加載js而非使用緩存

強制不要緩存:
<meta http-equiv=Cache-Control content=no-cache /> 
必須結合其餘:
<!-- 禁止瀏覽器從本地緩存中調閱頁面。--> 
<meta http-equiv="pragram" content="no-cache"> 
<!--網頁不保存在緩存中,每次訪問都刷新頁面。--> 
<meta http-equiv="cache-control" content="no-cache, must-revalidate"> 
<!--同上面意思差很少,必須從新加載頁面--> 
<meta http-equiv="expires" content="0"> 
<!--網頁在緩存中的過時時間爲0,一旦網頁過時,必須從服務器上從新訂閱--> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
相關文章
相關標籤/搜索