开发者

setInterval window focus and hibernation

开发者 https://www.devze.com 2023-01-09 03:52 出处:网络
I\'ve run into an odd issue. I have a javascript which uses setInterval to keep a session alive. But, it seems that if the browser is left unattended for a period (either leaving it open over night, o

I've run into an odd issue. I have a javascript which uses setInterval to keep a session alive. But, it seems that if the browser is left unattended for a period (either leaving it open over night, or out of focus working in another application) the setInterval is not firing in IE and the session is allowed to expire. This does not happen in firefox.

Does anyone know if this is a known issue with setInter开发者_开发百科val in IE and are there any good solutions?

EDIT (more info on what the setInterval is executing):

setInterval is calling an ajax function which asks the server to update the session timeout.

The interval is set to fire at half the rate of the session timeout (fires every 10 minute, session times out in 20minutes).


have you tried setTimeout within the same function ? probably is the same thing but worth a shot.

0

精彩评论

暂无评论...
验证码 换一张
取 消