onpopstate事件,比如:跳转到百度
<script>
window.onpopstate = function() {
window.location.href = 'http://www.baidu.com';
};
//加入以下俩行代码,才能触发
window.history.pushState('forward', null, '#');
window.history.forward(1);
</script>
onpopstate事件,比如:跳转到百度
<script>
window.onpopstate = function() {
window.location.href = 'http://www.baidu.com';
};
//加入以下俩行代码,才能触发
window.history.pushState('forward', null, '#');
window.history.forward(1);
</script>
本文标题:监听浏览器“返回”按钮跳转指定URL
本文链接:https://www.haomeiwen.com/subject/vyucqqtx.html
网友评论