问题描述
我想知道有没有办法处理浏览器退出事件.
I would like to know if there is any way to handle the browser exit event.
例如,我想在用户点击交叉出口或关闭浏览器时发送查询.
For example, I would like to send a query when the user click on the cross-exit or simply close his browser.
推荐答案
这个帖子可能会提供一些见解:http:///forums.devarticles.com/javascript-development-22/how-to-stop-browser-from-closure-using-javascript-8458.html
This thread might shed some insight:http://forums.devarticles.com/javascript-development-22/how-to-stop-browser-from-closing-using-javascript-8458.html
我还没有对此解决方案进行试运行.但似乎有可能.
I haven't given this solution a test-run yet. But it seems possible.
这里有关于 onbeforeunload
事件处理程序的更深入的讨论.http://bytes.com/topic/javascript/insights/825556-using-onbeforeunload-javascript-event
Here's a more in-depth discussion on the onbeforeunload
event handler.http://bytes.com/topic/javascript/insights/825556-using-onbeforeunload-javascript-event
然后总是quirksmode.不幸的是,quirksmode 尚未涵盖加载/卸载事件.如页面所述:
And then there's always quirksmode. Unfortunately the load/unload events are not yet covered by quirksmode. As stated on the page:
我还没有测试加载和卸载事件;它们稍后会添加到表格中.
这篇关于ExtJS:处理浏览器退出事件(点击交叉退出)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!