I'm working under asp.net and I wonder if is possible to display a custom save prompt (lets say a div with styles, a message and some buttons) when the user is trying to leave the page.
I've seen the onunload and onbeforeunload js events.
The onunload event seems to does not work for my purpose, because I display the message but I can't prevent the user leaving the page.
The onbeforunload could be useful just because I can prevent the user leaving the page, but the prompt is responsability of the navigator, and I want to implement it!
I think there is not another option than onbeforeunload to warn the user about possible losses of work but I expect helpful answers.
Related question: http://stackoverflow.com/questions/765996/prompting-user-to-save-when-they-leave-a-page