关闭标签时浏览器会触发哪些事件? [英] What events does ie browser trigger when closing tab?

查看:742
本文介绍了关闭标签时浏览器会触发哪些事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于在原始Internet Explorer(IE)中关闭选项卡时浏览器会触发什么事件,我有一个问题。我正在基于CHtmlView创建自己的浏览器,它是多标签。当我关闭导航到[ Live800-Chat窗口,我将在关闭前收到确认对话框。但在我自己的浏览器中,它立即关闭。关闭标签时我做了什么:

1.删除标签控件。

2. destory CHtmlView标签相关实例。

我该怎么办?如果我也想获得确认对话框,还要做更多的工作吗?

(如果我点击页面中的关闭按钮,我可以正确获得确认对话框。我不熟悉java脚本,所以我不知道关闭标签时听到了什么事件。)



我尝试了什么:



我没有找到任何有效的方法来尝试。

I have a question about what event will browser trigger when closing tab in the original Internet Explorer(IE). I'm making my own browser based on CHtmlView, it's multi-tabs. When I close tab which navigated to [Live800-Chat window] in IE, I will get a confirm dialog before close. But in my own browser, it closed immediately. What I do when close tab:
1. remove tab control.
2. destory CHtmlView instance of the tab related.
What should I do further more if I want to get the confirm dialog too?
(If I click close button in the page, I can get the confirm dialog correctly. I'm not familiar with java script, so I don't know what events it listened when closing tab.)

What I have tried:

I didn't find any effective method to take a try.

推荐答案

尝试 HERE



特别是< body onunload = myFunction()> 可能很有用。


好吧,我发现确认对话框实际上是处理 windows.onbeforeunload的结果()在javascript中,就像这样:

Well, I found that the confirm dialog actually is the result of handling of windows.onbeforeunload() in javascript, just like this:
window.onbeforeunload = function() { 
    return "Are you really want to exit?";
}



所以我现在的问题是回调的事件是什么 windows.onbeforeunload()

我可以在自己的浏览器中触发事件吗?怎么样?

有人可以提供帮助吗?


So my question now is what is the event for the callback windows.onbeforeunload()?
Can I trigger the event in my own browser? and how?
Does anyone can help?


这篇关于关闭标签时浏览器会触发哪些事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆