I'm looking for an event which will fire whenever the user switches away from the page to another tab, and another event which fires when the user switches back to the tab again.
window.onblur
and window.onfocus
don't seem to work correctly across all browsers
Is there a proxy I could look at in order to synthesize this event?
window.onfocus/onblur
have been available since before the Browser Wars, and their behavior hasn't changed much. Apparently there are some bugs in implementations, but no differing semantics. – Bowiewindow.onblur
offhand) will trigger an obnoxious email subscription modal. Any developer worth their weight in mulch should test to make sure they're not annoying their users. – Carden