Specific to google chrome: I'm trying to detect when a page loses focus, but not when it loses focus to the javascript console / other dev tools (i.e. the page is still the primary focus).
Any ideas?
I've tried using window.onblur
and visibilitychange
events.
Short use case: I'm working on a game and for some reason when it's running my editor (sublime text 2 on OSX) slows to a crawl. If I change window focus it's fine. So I'm trying to pause the game when I go to my editor but leave it running when I'm in the javascript console
[edit]
Since my question is apparently unclear, trying to clarify: I want to be able to tell the difference between:
- switching tabs, switching apps
- going to the javascript console