As per how StackOverflow does it when you are adding a question or replying to a question;
I\'d like to prompt the user with a;
\"Are you sure you wa
You need to implement window.onbeforeunload and return your message from it as a string:
window.onbeforeunload = function() {
if (theUserHasStartedEditing) {
return "You have started writing or editing a post."
}
}
There's an online demo here: http://www.4guysfromrolla.com/demos/OnBeforeUnloadDemo2.htm