Is it possible to determine whether the user is active on the current web page or, say, focused on another tab or window?
It seems that if you switch tabs, any JavaScript set to timeout / interval continues to work. It would be nice to be able to "pause" events when the user is not on the page.
Would it be something like attaching a mouseover event to the body, or would it be too resource intensive?
source
share