javascript - Event for when user switches browser tabs -
I am looking for an incident that the user will switch from page to second tab, and another incident when The user switches back to the tab again.
window.onblur and window.onfocus in all browsers
Can I see a proxy to synthesize this event?
You can try to use a framework, such as MooTools or jQuery which is a cross-browser Provide support. They should be able to detect more reliability with the Blurring
and Focus
events for the browser window.
I have personally used jQuery with a lot of success:
$ (window) .blur (function (e) {// put the blur action here} ); $ (Window). Focus (function (e) {// focus action here}};
Comments
Post a Comment