Detect browser focus/out-of-focus via Google Chrome Extension
Posted
by Paul
on Stack Overflow
See other posts from Stack Overflow
or by Paul
Published on 2010-04-04T11:01:07Z
Indexed on
2010/04/04
11:03 UTC
Read the original article
Hit count: 819
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!
© Stack Overflow or respective owner