Unable to unbind the window beforeunload event in Jquery
beforeunload
doesn't work reliably this way, as far as binding goes. You should assign it natively:
window.onbeforeunload = function() {
return 'You have not yet saved your work.Do you want to continue? Doing so, may cause loss of your work' ;
}
And in your save method:
window.onbeforeunload = null;