Nuno
Nuno

Reputation: 3622

browser.onfocus() aka window.onfocus() for all browser tabs

Is there any way that, if you have 2 or more open tabs of the same page, when you focus a tab, all other tabs will be instantly notified with "focus()"?

I give as example the Facebook Chat. If you receive a new message, all tabs keep blinking "New message from {name}!". And, if you focus a tab, all other tabs are instantly synchronized. I checked Firebug, and Facebook doesn't send any ajax request to synchronize the other tabs.

Let me know if you have any idea,
Thank you!
Nuno

Upvotes: 2

Views: 302

Answers (1)

Tom
Tom

Reputation: 44821

This is done via the server, using comet. The focused tab sends a message to the server, the all the tabs hear the event comming back via the long poll.

Upvotes: 1

Related Questions