I've been hanging around in the jQuery IRC-Channel today, when somebody came in and asked a simple question:
<simulation> how can i know if the page is on visible tab or passive tab ?
At first I thought this'd be impossible. Neither I there an API that I know of, nor should it be possible because of privacy. (Note: There are Fx internal APIs like
Thankfully recently Browser vendors added the requestAnimationFrame function. We can use that to hack something together.
load the reqAF-shim: https://gist.github.com/997619 and save it to any variable, eg reqAF.