views:

47

answers:

1

Now, I have script that works, but only if time interval for closing is small (5mins works), but when I try to set timeout to 15mins, it fails every time. The script I'm using is:

function openClose(){
    my_window = window.open('http://www.somesite.com',
    "mywindow","status=1,width=1010,height=740");  //this should execute closepopup() after 15mins if my math is correct
    setTimeout(closepopup,900000); 
    }
    function closepopup(){
        if(false == my_window.closed){
            my_window.close();
        }   
    }
A: 

Just a thought - could garbage collector dispose unwanted variables? I can see that my_window is a global one, try to persist timer variable as well:

timer = setTimeout(closepopup,900000)

Please, let me know if this works for you.

dmitko