How detect a tab getting focus?
How can I do something like "browserTab.onfocus = myFunction" by which I mean that "myFunction" would get control any time something in it's browser tab gains focus? E.g., when the user switches from a different browser tab or a non-browser window. I don't need to know what got focus, just that something did in that tab.
"window.onfocus = myFunction" with event capturing works fine except when the main window contains frames. Doing document.getElementById('iframeId').contentWindow.addEventListener('focus',myFunction,true) to add an onfocus handler to the iframe's document works in Firefox except when the frame's content comes from another site, which is my case and I cannot modify that site. I'd rather not poll using document.hasFocus().
Originally Posted by DougL
I only want to know if something in the tab gets focus. I don't really care to get control of another domain.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread