共计 230 个字符,预计需要花费 1 分钟才能阅读完成。
以后页面点击返回后,返回到下级页面
在下级页面再次点击返回有效
window.onload = () => {history.pushState("tmp", null, null); | |
window.onpopstate = () => {history.pushState('new', null, null); | |
}; | |
} |
检测用户触发浏览器返回
window.onpopstate =(event) => {console.log(event.state); | |
alert("你点击了返回,老哥"); | |
}; |
正文完
发表至: javascript
2021-12-14