Answer the question
In order to leave comments, you need to log in
Is the OnBeforeUnload event not supported by the latest versions of Chrome and FF?
If yes, how long ago? And can it be replaced with something? I need to display a message when the browser tab is closed.
Answer the question
In order to leave comments, you need to log in
Everything worked as it should. Here's a basic example from the documentation that works great in the latest versions of chrome and firefox:
window.onbeforeunload = function (evt) {
var message = "Document 'foo' is not saved. You will lost the changes if you leave the page.";
if (typeof evt == "undefined") {
evt = window.event;
}
if (evt) {
evt.returnValue = message;
}
return message;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question