Answers for "how to ask a user to leave browser whild on a webpage"

2

javascript leave page warning

window.addEventListener("beforeunload", function (e) {
    var confirmationMessage = 'It looks like you have been editing something. '
                            + 'If you leave before saving, your changes will be lost.';

    (e || window.event).returnValue = confirmationMessage; //Gecko + IE
    return confirmationMessage; //Gecko + Webkit, Safari, Chrome etc.
});
Posted by: Guest on May-29-2020

Code answers related to "how to ask a user to leave browser whild on a webpage"

Code answers related to "Javascript"

Browse Popular Code Answers by Language