1 /**
 2      * 如果是直接输入url访问的则刷新页面(防止缓存页面)针对Chrome,其他浏览器刷新referrer始终会为空,所以给个随机路径访问就加载不到缓存了。
 3      */
 4     var userAgent = navigator.userAgent; // 获得浏览器的userAgent字符串
 5     if(userAgent.indexOf("Chrome") > -1) {
 6         if(document.referrer == "") {
 7             document.location.reload();
 8         }
 9     } else {
10         if(document.referrer == "") {
11             document.location.replace(document.location.pathname + "?input=" + Math.random());
12         }
13     }

 

相关文章:

  • 2021-07-20
  • 2021-04-20
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案