微信開發中經常遇到緩存問題
無法跳轉
url后加上隨機數
window.location.href = baseUrl + '?v='+(new Date().getTime());
window.location.href = baseUrl + '?v='+Math.random();
css,js緩存
文件名后加上版本號
<link href="css/demo.css?v=123" rel="stylesheet">
手動清理緩存
微信瀏覽器在ios和安卓中瀏覽器內核不一樣;從而不同的系統和不同版本的微信方式也各有不同。清理緩存的方式也就各種不一樣的:
android:
微信里訪問 debugx5.qq.com,拉到頁面最底部,有清理緩存的選項。
ios:
1、 取關公眾號,重新關注;
2.、 退出微信賬號登陸,重新登陸微信;
3、 微信設置-通用-存儲-清理緩存;
4、 進入頁面,右上角‘...’選項中點擊“刷新”