1.小程序加载页面时不使用缓存
javascript
{
"webView": {
"cacheMode": "no-cache"
}
}
2.通过 JavaScript 清除页面缓存
javascript
function clearCache() {
if ('caches' in window) {
caches.keys().then(function (keyList) {
return Promise.all(keyList.map(function (key) {
return caches.delete(key);
}));
}).then(function () {
console.log('Cache cleared');
});
}
}
window.onload = clearCache;