The beforeunload
in IE is a bit quirky; Returning ANYTHING in your event handler (even null) will cause it to pop up a box asking the user if the user is quite sure they want to leave the page.
You can try this as a possible workaround:
var beforeUnloadFired = false;
$(window).bind('beforeunload', function (event) {
if (!beforeUnloadFired) {
beforeUnloadFired = true;
event.returnValue = "You have attempted to leave this page. Are you sure you want to navigate away from this page?";
}
window.setTimeout(function () {
ResetUnloadFired();
}, 10);
});
function ResetUnloadFired() {
beforeUnloadFired = false;
}
Couple of references: https://developer.mozilla.org/en-US/docs/DOM/Mozilla_event_reference/beforeunload?redirectlocale=en-US&redirectslug=Mozilla_event_reference%2Fbeforeunload
and
http://msdn.microsoft.com/en-us/library/ie/ms536907(v=vs.85).aspx
NOTE: see the "Remarks" for pertinent information within that second reference.