在微信浏览器中 location.reload() 不刷新解决方案(直接调用方法)

1、问题

  在微信浏览器中,需要时刷新当前页面。

  正常情况下我们直接使用 location.reload 方法来刷新。

 

2、解决方法

function realod(){
  var {search,href} = window.location;
  href = href.replace(/&?t_reload=(\d+)/g,'')
  window.location.href = href+(search?'&':'?')+"t_reload="+new Date().getTime()
}

  

  直接调用该方法,兼容参数等形式。

 

posted @ 2018-09-26 00:22  小结巴巴吧  阅读(450)  评论(0编辑  收藏  举报