当前位置:网站首页>监听浏览器返回操作-禁止返回上一页
监听浏览器返回操作-禁止返回上一页
2022-07-17 00:09:00 【666-上上签】
微信公众号开发,从登录页获取用户信息,再跳转指定页,返回上一页的时候会跳转登录页面,加禁止返回,保留本页面地址
// 利用pushState向浏览历史列表中插入当前页面,在点击后退前和点击时都插入一次,那样无论点前进还是后退永远都会留在这个页面了
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL);
window.addEventListener("popstate",function(e) {
console.log(e);
history.pushState(null, null, document.URL);
}, false);
}
链接:History
边栏推荐
猜你喜欢
随机推荐
15 数据流的第 K 大数值
基于CSI的通信感知一体化设计:问题、挑战和展望
Swift - 泛型
Today's codefarmer girl summed up the notes on the difference between the method of jQuery processing cache and the method of event delegation
Dhfs read / write process
如何建设实时开发平台,深入释放企业实时数据价值?
05 BTC network
Swift 【Class】【struct】
Modifier of v-on
touchID 和 FaceID~1
wkwebview白屏
The use of libtomcrypt password Library
爭奪存量用戶關鍵戰,助力企業構建完美標簽體系丨01期直播回顧
AVPlayer添加播放进度监听
基于移动终端的MIMO阵列三维成像技术
我已经妥协了 大家既然都要叫我yelin 那我也没办法了
01-BTC-密码学原理
typeorm mysql upsert操作
大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?
Why is opensea the absolute monopolist of NFT trading market?
![[ahu2021 school competition] EZ injection](/img/44/644c27f86cbbc9c6630249d2111066.png)








