2
I’m using the function OnUnload javascript, but I can’t find an error. O 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?