移动端浏览器监听返回键

jshtml

var count = 0 ;
window.history.pushState(null, null, "#");
window.addEventListener("popstate", function(e) {
window.history.pushState(null, null, "#");
  document.getElementById('logView').innerHTML = "用户点击返回" + (++count)
})

htmlspa

<p id="logView">test2</p>
相关文章
相关标签/搜索