Answer the question
In order to leave comments, you need to log in
How to display a message when closing a bookmark in JavaScript?
Hello, I want to make it so that when you close the browser window with our site or something else, when you leave our site, display a message
How to do this?
Answer the question
In order to leave comments, you need to log in
window.onbeforeunload = function () {
return "Точно хочешь закрыть страницу?";
}
You can display the table using onbeforeunload
Example
Doesn't work everywhere. And almost none of the modern browsers allows you to change the message.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question