uniapp webview清理缓存

后端服务器配置,JS/CSS文件的缓存时间为 :-1s
location ~ .*.(js|css)?$
{
expires -1s;
error_log off;
}

前端打开webview页面处:
//ios 禁用缓存,测试生效!!
let cache1 = plus.ios.newObject('NSURLCache');
let cache = plus.ios.invoke(cache1, 'sharedURLCache');
plus.ios.invoke(cache, 'removeAllCachedResponses');
plus.ios.invoke(cache, 'setDiskCapacity:', 0);
plus.ios.invoke(cache, 'setMemoryCapacity:', 0);

//安卓端缓存清理。
plus.cache.clear();

亲测有效 ~

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部