views:

170

answers:

1

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!

A: 

I know firefox manages it's focus much better than Chrome. One listener tells when firefox is out of focus entirely. I can't figure out how to do that with Chrome.

robr
Kewl. I was hoping to move to Google Chrome for creating extensions but it seems Firefox still provides more control. Thanks!
Paul