I\'m using window.onbeforeunload
to display a message to the user on windows close, the function works well with Chrome and IE but it doesn\'t work with Firefox
Using the code given in the MDN works for me in firefox/chrome/IE11 (haven't try other browser for now).
window.onbeforeunload = function (e) {
var e = e || window.event;
// For IE and Firefox
if (e) {
e.returnValue = 'Any string';
}
// For Safari
return 'Any string';
};
here is the doc : Mdn window.onbeforeunload doc