浏览器关闭或刷新事件--window.onbeforeunload
2024-09-01 23:54:43
window.onunload=function(){
//不可以阻止浏览器的刷新或者关闭
return false;
}
window.onbeforeunload=function(){
//可以阻止浏览器的刷新或者关闭
return false;
}
window.onclose貌似不会触发浏览器关闭事件。。。
参考:
http://blog.sina.com.cn/s/blog_995c1f630101a9el.html
http://www.dslreports.com/forum/r11684650-window-onclose-vs-window-onunload
最新文章
- python实验一:画图
- EVE ToDo
- POJ 1743 后缀数组
- Codeforces Round #184 (Div. 2) E. Playing with String(博弈)
- Android的四大组件
- ASP.NET MVC Error
- 富有魅力的git stash
- Python prettytable的使用方法
- JAVA多线程解惑之多线程返回值
- Unity Navigation自动寻路
- fastjson的常用使用方法
- Javascript实例技巧精选(7)—设置和获取文本框与文本域的光标位置(兼容IE和Chrome,Firefox)
- iOS开发—— UIImagePickerController获取相册和拍照
- 【BZOJ2004】公交线路(动态规划,状态压缩,矩阵快速幂)
- 第十课html5 新增标签及属性 html5学习5
- 异步请求取得json数据
- 75.iOS内存管理
- [HDU4906]Our happy ending
- windows Server 2008 R2 TFS2010的备份
- django 同步数据库出现 No changes detected 的可能原因
热门文章
- Cocos2d-x粒子系统
- [转]FPGA网站推荐
- hibernate出现 org.hibernate.PropertyNotFoundException: field [departmen] not found on cn.itcast.hibernate.domain.Employee1错误
- c 字符串 函数
- 概率dp HDU 4405
- Xcode iphone模拟器运行不流畅
- 《Java设计模式》之构建者模式
- Unix高级环境编程—进程控制(一)
- vue element-ui 自动获取光标
- MethodDispatcher—Cherrypy对REST的支持