Check browser tabs by JavaScript?

browser, javascript, webbrowser-control

Solution

You can attach the `onBlur` and `onFocus` events to the `window`; that will tell you if you have focus or not. I have tested this and it works. You cannot check another page, but you can definitely check your own.

Problem

Can I check if host page for a JavaScript is active by the browser's tab in IE7/FF/Opera? Checking other tabs than the page where this JS runs would probably be a security risk though.. My other option is a method I remember by prototype to check if the mouse cursor is active, but it's not that accurate.

Original source