Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created September 1, 2021 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/d7dea0c8ffb55ace7f43bbae72e65439 to your computer and use it in GitHub Desktop.
Save parzibyte/d7dea0c8ffb55ace7f43bbae72e65439 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Prevenir que usuario deje la página - By Parzibyte</title>
</head>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias placeat laborum, magni fugiat ab, rerum iure
ducimus, asperiores sequi dolores ex quos labore exercitationem vitae modi autem repudiandae pariatur earum!</p>
<script>
window.addEventListener("beforeunload", (evento) => {
if (true) {
evento.preventDefault();
evento.returnValue = "";
return "";
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment