Detect browser focus/out-of-focus via Google Chrome Extension
- by Paul
Is there a way to find out if Google chrome is in focus or out of focus? I'm creating an app which needs to know if the user is currently using the browser or not.
By tying the detection through the content script in a Google extension, I've tried using blur and focus but the problem is that clicking on the address bar also fires a blur event. Same goes for detecting mouse movement, where moving the mouse outside of the viewing area will not be detected.
I've also tried looking at onFocusChanged but it seems it only detects changes in chromes' windows not apps outside of Chrome.
Anyone have other ideas for this? Also, would this be any easier if I created an add-on for firefox instead?
Thanks!