当前位置:网站首页>监听浏览器返回操作-禁止返回上一页
监听浏览器返回操作-禁止返回上一页
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
边栏推荐
- 14 检查整数及其两倍数是否存在
- IPFs mount to local disk
- TCP and UDP, TCP server and client, UDP server and client
- 开源项目丨 Taier 1.1 版本正式发布,新增功能一览为快
- 毒瘤 DDD
- The interviewer asked: how to check if redis suddenly slows down?
- Dhfs read / write process
- 3章 性能平台GodEye源码分析-内存模块
- V-model principle and modifier
- Xcode11添加引导页(升级后Launch Images Source选项不见了)
猜你喜欢

mysql innodb 事务相关记录

Introduction to software vulnerability analysis (II)

NFT-数字藏品之库里为何花116万买一个NFT头像?回顾NFT头像的“发迹史”或许能找到答案

The use of libtomcrypt password Library

06 BTC mining difficulty

Dhfs read / write process

What is "digital collection"?

Redis 高可用原理

Introduction to software vulnerability analysis (4)

NFT数字藏品平台有哪些?哪些平台值得珍藏?
随机推荐
雷达通信一体化波形设计综述
NFT排行榜-NFT实盘最新地址:NFT排行榜.COM
面试官问:Redis 突然变慢了如何排查?
情况说明和感想
wkwebview白屏
波卡生态中“中继链”、“DOT”的常见问题解答
Express project creation and its routing introduction
NFT differentiation trend has shown, how to capture value?
Cannot find module ‘process‘ or its corresponding type declarations.
欢迎进入Hensen_的博客目录(全站式导航)
ipfs 文件持久化操作
数据指标体系如何搭建才最有效,从0到1带你快速入门
IPFs file persistence operation
The platform of digital collection NFT is good
Router and keep alive
binary search
TCP and UDP, TCP server and client, UDP server and client
10 完成一半题目
nodejs-uuid
Xcode11新建项目后的一些问题