在某些场景下微信根本就不检查,网页是否更新。
脏话。。。
可以通过在nginx里面设置html文件 expires -1;
这会影响其他浏览器或者有些情况我们无法做这个配置,我们可以使用以下js代码实现强制刷新html
<script> (function(){ if(navigator.userAgent.indexOf('WeChat')!=-1){ var href=window.location.href; if(href.indexOf('?_v=')==-1&&href.indexOf('&_v=')==-1){ if(href.indexOf('#')!=-1){ href=href.substring(href); } if(href.indexOf('?')!=-1){ window.location.href=href+"&_v="+new Date().getTime()+window.location.hash; }else{ window.location.href=href+"?_v="+new Date().getTime()+window.location.hash; } } } })(); </script>
对已经被缓存的网页无效。可以先在公众号菜单等位置给地址加一个版本号参数









网友评论