Is there any DOM event when the browser tab loses / gains focus? I know that there are blur and focus events on the window , but they also fire when the browser window as a whole loses focus. Then the browser may still be visible to the user. Of course, such an event would be browser specific, but this is normal.
The reason I want this is because I run an animation that can consume quite a lot of CPU time. When the browser tab is not displayed, there is no reason to continue the animation. Now I know that modern browsers reduce the resolution of the timer for background tabs, but I can actually pause the animation so that CPU time is not consumed.
If you're interested, here is what I write: http://panzi.github.com/Browser-Ponies/
panzi source share