Click here to Skip to main content
14,970,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Updated 28-Feb-16 16:39pm

Try HERE for most of the available events.

In particular, <body onunload="myFunction()"> might be of interest.
l-O_O-l 25-Feb-16 2:07am
I'm sorry, but I'm not ask the events of javascript. What I asked is the events browser post when closing tabs. I'm doing VC++/MFC things.
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?";

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?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900