浏览器后退返回强制刷新

566 阅读1分钟

 // thanks for stackoverflow  返回的时候强制刷新        window.addEventListener('pageshow', function (event) {            console.log('performance', window.performance);            if (event.persisted || (window.performance &&                window.performance.navigation.type == 2)) location.reload();        });

参考网址

  1.  https://www.jianshu.com/p/a94aa53f3637
  2. https://juejin.cn/post/6844904002103033870

  3. https://stackoverflow.com/questions/17432899/javascript-bfcache-pageshow-event-event-persisted-always-set-to-false