JS在即将离开当前页面(刷新或关闭)时触发事件
2024-09-30 19:52:25
// onbeforeunload 事件在即将离开当前页面(刷新或关闭)时触发
window.onbeforeunload = function () {
return /^\#\/ipinfo/.test(location.hash) || /^\#\/ipdetail/.test(location.hash) ? '您正处于编辑状态,确认离开该页面么?' : null;
};
最新文章
- .net 下载文件几种方式
- Makefile目标,伪目标,头文件自动依赖
- 34、Shiro框架入门三,角色管理
- Python入门-行和缩进
- 新建arcgis api for android 项目失败
- 牛客OJ——[编程题]A+B和C__如何输入多组测试数据(测试OK)
- noip2011 公交观光
- 用C++实现的八皇后问题
- [poj2585]Window Pains_拓扑排序
- C++语言编译系统提供的内部数据类型的自动隐式转换
- 【转】地球坐标系 (WGS-84) 到火星坐标系 (GCJ-02) 的转换算法
- 获取linux帮助命令
- Java相关面试题总结+答案(二)
- windows下提权基础
- python语法与c++不同点
- js实现简易版validate
- leetcode 703数据流中的第K大元素
- hystrix项目实战
- 分布式存储MooseFS
- vue-router利用url传递参数