How To Show Confirmation Dialog When Leaving A PageApr 18, 2006
I would like to know how to display a confirmation message when a user attempts to navigate away from a page. For example, if a users clicks the X to close the window, or chooses another link from his favorites, I want to display a message that says something like "Are you sure you want to navigate away from this page, click OK to continue, or Cancel to remain on this page."
I noticed this on meebo.com. After you log in, when you try to close the window you get a confirmation dialog like I describe above. I didn't think this was possible to show a confirmation dialog using the onunload event, but I could be wrong.