Take a website with some kind of notifications system showing the user a count of their unread notifications or similar. (Facebook, Google+, GMail et c.)
Now perform an action in one browser tab, that changes or clears the count. Does this immediately propagate to all other tabs you have open on the site?
If not – this example is for you!
As it happens, this is really easy to do in
browsers supporting localStorage
(which is all of them, back to 2009; even IE8),
by subscribing to the storage
event,
as demonstrated in this example.
Open this page in two browser tabs or windows, and click the buttons.
The event fires on all other windows accessing the same localStorage
,
so the update will propagate over your whole site by default, as you want.
At the time of posting this (September 23, 2015), none of the social services linked are this kind to their users.
If your site is using alert()
or similar
(Google Calendar comes to mind)
to alert the user of some kind of alarm or scheduled event you have set,
similarly: please only fire off that alert in one of all open windows.
You can apply this basic technique for cross-tab synchronization to make sure you don't send off a dozen tabs or more grabbing user focus in a wild dance of confusion, frustration and aggravation.
Thanks for reading, and happy hacking!