Is there a reliable way to determine if a browser tab or window is inactive or not in focus?

后端 未结 5 2218
一整个雨季
一整个雨季 2020-12-30 11:02

I\'ve got a javascript timer that is making XMLHTTP requests on a constant basis (once every 10 seconds). I\'d love to be able to pause the timer when the window or tab los

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-30 11:36

    The above code is working fine in Safari v3.0.4 (WebKit 530+), the bug has been resolved it seems. I've checked it in Google Chrome v3.0.195.27 and it has the same Safari bug, although it has a newer version of WebKit.

提交回复
热议问题