1
Is there any way to cancel Unload() or Onbeforeunload()?
Something like that:
window.onbeforeunload = function(){
//ação aqui
break; //cancela o fechamento da pagina sem exibir nenhum alert
}
I need to open a div (popup) when the user clicks close or back, the idea was to put
document.getElementById('minhaDiv').style.display = 'block';
before the break, but this is not right because the break does not work and the page is closed. I hope to understand a little this salad!