微信瀏覽器處理緩存方式:
1.頭部處理緩存信息。
? ? ? ? ? ? ? ? ?<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
? ? ? ? ? ? ? ? ? <meta http-equiv="Pragma" content="no-cache" />
? ? ? ? ? ? ? ? ? ?<meta http-equiv="Expires" content="0" />
2.修改js或css文件時(shí)加上版本號(hào)信息。
? ? ? ? ? ? ? ? ? ?<link href="css/app.css?v=20190625" rel="stylesheet">
? ? ? ? ? ? ? ? ? ?<script type="text/javascript" src="js/app.js?v=20190625"></script>
3.跳轉(zhuǎn)另一個(gè)頁(yè)面最好封裝一個(gè)方法增加隨機(jī)數(shù)电谣。(可以參考下邊的方法)
/**
?*? 清理緩存的方法
?* 1.如果url地址有?加&秽梅,如果沒(méi)有加?并且增加隨機(jī)數(shù)?
?*/
function toNewPage(url){
?? ? if (url.indexOf('?') >0) {
?? ??? ? ?url+="&"+Math.random();
?? ? } else {
?? ??? ? ?url+="?"+Math.random();
?? ? }
?? ?window.location.href=url;
}