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

一、问题

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

  正常状况下咱们直接使用 location.reload 方法来刷新。微信

 

二、解决方法

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

  

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

相关文章
相关标签/搜索