Saving a post - generates confirmation

May 20, 2011 at 5:38 PM

If you edit a post and then click "Save", you'll receive a message which says

"Are you sure you want to navigate away from this page?

   null

press OK to continue, or Cancel to stay on the current page."

You can fix this by editing Edit.cshtml and changing window.onbeforeunload from:

window.onbeforeunload = function() {
    return alertOnLeaving ? 'If you navigate away from this page you\'ll lose any unsaved changes' : null;
} 

to:

window.onbeforeunload = function() {
    if(alertOnLeaving)
        return alertOnLeaving ? 'If you navigate away from this page you\'ll lose any unsaved changes' : null;
}