简体   繁体   English

JavaScript或jquery的浏览器选项卡关闭事件

[英]Browser Tab Close Event for javascript or jquery

I have added a div which contains some survey questions which is initially hidden. 我添加了一个div,其中包含一些调查问题,这些问题最初是隐藏的。 Once the user closes the window or navigate away from the page, I need to popup the survey div to get the confirmation. 用户关闭窗口或离开页面后,我需要弹出调查div以获得确认。 I know there is a browser default confirm box method by using onbeforeunload event. 我知道有一个使用onbeforeunload事件的浏览器默认确认框方法。 But I need to popup the div rather than the browser default confirm box. 但是我需要弹出div而不是浏览器默认的确认框。 Is there any way to do this? 有什么办法吗? (or is there any way to interrupt the close event without even clicks on the "Stay on page" button found in the browser default confirm box?) (或者是否有办法中断浏览器事件,而无需点击浏览器默认确认框中的“停留在页面上”按钮?)

UPDATE : it seems we cannot do the action you are asking. 更新 :看来我们无法执行您要的操作。 There are some solutions to cover this in IE but overall its not possible. 有一些解决方案可以在IE中解决此问题,但总的来说不可能。 Ignore all the previous code. 忽略所有先前的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在javascript或jquery中跟踪浏览器刷新/返回/选项卡关闭和浏览器关闭事件 - How to track browser refresh/back/tab close and browser close event in javascript or jquery javascript中如何检测浏览器标签关闭事件 - How to detect browser tab close event in javascript Javascript 或 ExtJS 的浏览器选项卡关闭事件 - Browser Tab Close Event for Javascript or ExtJS 反应,Javascript - 捕获浏览器/标签关闭事件 - React, Javascript - Capture browser/tab close event 使用JavaScript的Android浏览器中的浏览器选项卡关闭事件 - Browser tab close event in android browser using javascript 使用 jquery/Javascript 在浏览器关闭或选项卡关闭时执行注销 - Perform logout on browser close or tab close using jquery/Javascript JavaScript浏览器关闭事件 - Javascript browser close event 在refress上显示自定义弹出窗口,并在javascript / jquery中关闭浏览器/选项卡 - show custom popup on page refress and browser/tab close in javascript/jquery 关闭当前的浏览器标签,并专注于特定网址的浏览器标签-javascript / jquery - Close current browser tab and focus on a browser tab of a specific url - javascript/jquery 如何在 angular 6+ 中检测浏览器关闭事件或选项卡关闭事件? - How to detect browser close event or tab close event in angular 6+?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM