Javascript timer in parent window is cancelled on child window close
Posted
by Tom Carter
on Stack Overflow
See other posts from Stack Overflow
or by Tom Carter
Published on 2010-03-24T09:19:26Z
Indexed on
2010/03/24
9:23 UTC
Read the original article
Hit count: 338
I have a user UserControl on a web page. There is a javascript timer started by the control on the client that causes a web service to be called every few seconds. If the user clicks on the control a new browser window is opened (with window.open() ) to show a different page. Note the onclick returns false so there is no postback to the page.
The page displayed in the second window also has a timer that operates in the same way as the first (calls a WebService at intervals). Upto this point everything is fine - each of the timers continue to run in their respective window.
However, when I close the second window (either by clicking on the cross of the window or by calling self.close() ) the timer in the first stops. I've no idea why.
Is there some relationship between the opener and opened window that I'm missing ?
© Stack Overflow or respective owner