my web-app has this:
$(window).bind(\'beforeunload\', function() { if(unSavedChanges == true) { return \'You have unsaved changes\'; }
I use normal javascript for this and works fine
function setConfirmUnload(on) { window.onbeforeunload = (on) ? unloadMessage : null; } function unloadMessage() { return 'Please stay on the page'; }