I found the following code on the internet:
<script type="text/javascript">
var popup = null;
function Abrir() {
if (popup!=null && popup.closed)
alert("A Janela foi fechada.n Abrindo novamente.");
if (popup!=null && !popup.closed){
}
else {
popup = window.open("http://www.google.com","Jan","height=350,width=200");popup.focus();
}
setTimeout("Abrir()", 2000); //javascript trabalha com milesimos
}
</script>
It fits well into the system I want to do, which checks to see if the open flap is still open, but needs an adjustment that I do not know how to do.
This code is in loop , when it gives the message that the window has been closed, it opens it again. Would he just send the message? And to order only once not to be sent all the time? That is, make the timer run only until it detects that the window has been closed, so it issues the alert and stops running the function again.
Update : I was able to mount the following code, what do you think?
<script type="text/javascript">
var popup = null;
function Abrir() {
popup = window.open("http://www.google.com","Jan","height=800,width=600");popup.focus();
setTimeout("Verifica()", 2000);
}
function Verifica() {
if (popup!=null && popup.closed){
$("#aguardetop").hide("slow");
$("#sucessotop").fadeIn();
Adiciona();
return;
}
if (popup!=null && !popup.closed){
}
setTimeout("Verifica()", 2000);
}
</script>