0

I remember that facebook did something similar,

Lets say you loaded facebook.com, browsed around a bit and then opened a new tab to read some news, meanwhile you had updates to your facebook feed, but they would not be automatically displayed when you switched back to the facebook tab, only when you switched to the facebook tab they would then fire the event for fetching the feed updates.

How is this done?

user838437
  • 1,451
  • 7
  • 23
  • 31
  • Have a look at http://stackoverflow.com/questions/1760250/how-to-tell-if-browser-tab-is-active – Niklas Dec 29 '11 at 11:38
  • Maybe this will help: - http://stackoverflow.com/questions/1060008/is-there-a-way-to-detect-if-a-browser-window-is-not-currently-active – Ayman Safadi Dec 29 '11 at 11:38

1 Answers1

1

It can by done by detecting in javascript if the browser window gained focus. Dynamic changes on the page or ajax calls are probably done only when the browser window has focus. More about detecting browser window focus in javascript:

Is there a way to detect if a browser window is not currently active?

Community
  • 1
  • 1
PanJanek
  • 6,593
  • 2
  • 34
  • 41