I'm using the OnUnload
function of javascript, but I can not find error. The alert
should be displayed before closing the browser, window, or loading another address bar, correct?
function close(){
alert("Não vá embora, inscreva-se...");
}
<body onunload="close()">
<input type="button" value="Aula JS - Eventos" onclick="clique()"></input>
<br>
<input type="text" name="txt_aula" onfocus="entra()" onblur="sai()"></input>
</body>
Does anyone know if this function still works in javascript?