Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
JavaScript exit page confirmer object
Um objeto JavaScript para confirmar se o usuário quer sair da página
function ExitPageConfirmer(message) {
this.message = message;
this.needToConfirm = false;
var myself = this;
window.onbeforeunload = function() {
if (myself.needToConfirm) {
return myself.message;
<script src="scripts/Prodis.ExitPageConfirmer.js"></script>
var exitPage = new ExitPageConfirmer("My confirmation message.");
<form onsubmit="exitPage.needToConfirm = false;">
<p><input type="text" onchange="exitPage.needToConfirm = true;" /></p>
<p><input type="submit" /></p>

This comment has been minimized.

Copy link

commented Dec 26, 2013

Valeu cara vou tentar colocar no meu site e no

depois se possível visualize alguns dos sites acima para que possa me informar se o código está correto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.