I have beforeunload
added in my js code as follows and it works in IE10
I would like to give the user a warning, nothing else
$(document).ready(function () {
init();
window.addEventListener("beforeunload", function () {
if (changeSubmitted) {
return 'If you choose to leave, the data entered will not be saved!';
}
return true;
});
});
However, the event doesn't seem to fire in Edge.
Unfortunately all major browsers removed support for the custom message in onbeforeunload
event, now they just show their own generic text. Except of IE :)
Take a look at browser compatibility list.