[英]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.