chrome 的onbeforeunload事件没有触发
2024-09-05 14:10:30
onbeforeunload event is not working when user not click inside the body of page
I want call one function when user open any page and without click on that page, he just close the page.
I have tried this to put one button and click on that button using coding after page loading is complete , but it is not working.
I am follow this link. W3School
In this link , when you not click in result portion and reload page then it will not display alert , but when you click result portion and reload page then it will displaying a alert.
This is because the onbeforeunload
is attached to the <iframe>
's window
object, and when you do unload the main page, this event won't fire unless you had focus on this iframe.
Same will happen with StackSnippet here:
onbeforeunload = e => true;
<span>click to toggle iframe's focus</span>
Run code snippetHide results
最新文章
- Android注解使用之ButterKnife 8.0注解使用介绍
- 怎么样在Myeclipse中配置JDK?
- 慕课网-Java入门第一季-6-8 使用 foreach 操作数组
- 再来一发!DB2 应用程序如何从数据库取数据 Fetch
- JQuery之正则表达式
- URAL 1936 Roshambo 题解
- lintcode :Trailing Zeros 尾部的零
- (转)原子操作 Interlocked系列函数
- (转)让浏览器支持Webp
- Fiddler屏蔽某些url的抓取方法
- 将简单的lambda表达式树转为对应的sqlwhere条件
- 为什么要使用Docker?
- JSON 序列化的时候忽略无效的属性值
- 南邮攻防训练平台逆向第四题WxyVM
- 函数纹理(国际象棋棋盘纹理&;粗布纹理)MFC
- MAC机下用Terminal操作MySql
- CCO2017 Vera and Trail Building 构造+图论
- CANopen和DeviceNet有何异同
- mac 类似Xshell
- email 校验