How to abort control the flow of window.onbeforeunload

I searched through Expert-Exchange's database before I posted this. I did see a lot of other posts, but nothing quite the same as my situation. Here is how I'm implementing onbeforeunload:

window.onbeforeunload = function() {

/* I am using this to detect edit changes in a form. I want to display my own *custom* message box to prompt the user whether or not
    he really wants to leave the page. So here are my two questions:

    1) If the user answers 'yes' to leave the page, how I can do so without the browser's native box coming up at all?
    2) If the user answers 'no', how do I abort the unloading without having to rely on the browser's native box?


Open in new window

Who is Participating?
David Johnson, CD, MVPOwnerCommented:
The reason you saw no answers is because you can't change it.
elepilAuthor Commented:
Thank you for your help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.