关闭窗口事件 [英] window closing event
本文介绍了关闭窗口事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在javascript中处理窗口关闭事件???
how to handle window closing event in javascript???
展开 | 选择 | Wrap | 行号
推荐答案
当您离开页面并且没有相应的事件源时,将始终触发unload和onbeforeunload事件...
它是一个弹出窗口还是您需要的主浏览器窗口处理?
亲切的问候
the unload and onbeforeunload events will always be triggered when you leave the page and they have no corresponding event source ...
is it a popup window or the main browser window where you need a handling?
kind regards
卸载和onbeforeunload事件将始终触发你走页面,他们没有相应的事件来源......
它是一个弹出窗口还是你需要处理的主浏览器窗口?
亲切问候
the unload and onbeforeunload events will always be triggered when you leave the page and they have no corresponding event source ...
is it a popup window or the main browser window where you need a handling?
kind regards
感谢您的回复。我在主窗口中需要这个。
thanks for reply. I need this in main window.
嗯......在这种情况下,你可以使用onbeforeunload / onunload来调用js-function来在用户离开你的页面时做一些事情。 ..没有真正/可靠的可能性来捕捉主窗口的关闭事件......
弹出窗口有一个你可能会要求的关闭属性,你可以检查它...
亲切的问候
hmm ... in this case you could just use onbeforeunload/onunload to call a js-function to do something when the user navigates away from your page ... there is no real/reliable posibility to capture the close-event of the main window ...
popup windows have a close-property that you might ask for and there you could check for it ...
kind regards
这篇关于关闭窗口事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文