I'm trying to use the $(window).on('beforeunload', function(){}); and editor.session.getUndoManager().isClean(); in the ace editor to check if the user made changes to a document but didn't click the submit button but for some reason it doesn't work Here's the code:
editor.on('change', function(IsChanged) {
var IsChanged = editor.session.getUndoManager().isClean();
});
var submitting = false;
$(window).on('beforeunload', function(){
if (submitting == false && IsChanged == true) {
retu "You have made some changes in the editor.";
};
});
But for whatever reason AlertUserOnUnload always retus a boolean of true.
