Does anyone know how I would display a <div>
that is hidden when the user clicks the close button in the browser window?
Does anyone know how I would display a <div>
that is hidden when the user clicks the close button in the browser window?
In case you could run a javascript that displays an alert or a modal for it, eg:
<script>
window.onbeforeunload = function (event) {
var message = 'Você tem certeza que deseja sair?';
if (typeof event == 'undefined') {
event = window.event;
}
if (event) {
event.returnValue = message;
}
return message;
}
</script>
Documentation about the beforeunload event.