Possible Duplicate:
How can I override the OnBeforeUnload dialog and replace it with my own?
Is there a chance to show custom popup (div) when user leave page?
I know there are beforeunload event, but it only show default popup. I need an custom popup with form inside it.
The short answer is no.
You will only be able to display the default popup that the browser provides. It is not possible to display a custom popup such as a
<div>as you are requesting, because by the time it is displayed the tab or window would have already closed.To display a default popup confirm box before the user leaves the page, you should use the following JavaScript code: