您的位置:首页 > 运维架构

window.onpopstate无法触发解决办法

2017-07-20 10:43 423 查看
在微信浏览器中加入window.onpopstate监听事件,但是一直无法触发,后来查找网上资料,找到一个解决办法

<script type="text/javascript">
window.onpopstate = function(event) {
console.log(sfa);
};
//加入以下俩行代码,才能触发
window.history.pushState('forward', null, '#');
window.history.forward(1);
</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  js html5