使用history.go(-1)可能会出现执行后直接读取缓存,不刷新页面的问题,这个跟手机的机型有关。(注:history.back()也会有这个问题。)

解决方法为在返回后的页面加上:

window.addEventListener('pageshow', function(e) {
    //如果检测到页面是从“往返缓存”中读取的,刷新页面
    if (e.persisted) {
        window.location.reload();
    }
});

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2021-12-08
  • 2021-10-16
  • 2021-08-03
  • 2021-11-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案