Merge pull request #3604 from thelounge/xpaw/beforeunload

Fix beforeunload not working
This commit is contained in:
Pavel Djundik 2019-12-19 14:57:44 +02:00 committed by GitHub
commit cd6821a196
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,9 +26,9 @@ socket.once("configuration", function(data) {
}
if (document.body.classList.contains("public")) {
window.addEventListener(
"beforeunload",
() => "Are you sure you want to navigate away from this page?"
);
window.addEventListener("beforeunload", (e) => {
e.preventDefault();
e.returnValue = "Are you sure you want to navigate away from this page?";
});
}
});