This question already has an answer here:
- Communication between tabs or windows 9 answers
Is it possible to have event-based communication between browser tabs/windows?
I known that it could be (at least theoretically) possible using local storage. Could you please provide small example of code doing that? Just send event in one tab, and receive it in another.
Are there any libraries/jquery-plugins that do that?
(I know that I can communicate between windows/tabs of the same browser using cookies; but that is not what I need; I would prefer event-based approach, I don't want recheck the state of the cookies every millisecond).
Give SignalRamp a chance.
You can attach any of the bindable class names to elements to syncronize the corresponding mousedown, mouseup, hover (mouseover, mouseout) or click events in the UI.
Localstorage has events that you can subscribe to to syncronize other pages.
Note: If you update a key's value in window A, the event will not be triggered in window A. It will be triggered in windows B & C.
Here is a demo: http://html5demos.com/storage-events
Open this page in several tabs. change the value on the input and see it reflected in divs.
Here is the code The Javascript:
Markup:
The HTML 5 spec discusses all the information passed in the event:
From: http://www.w3.org/TR/webstorage/#the-storage-event
Using this event, you can make other pages react to when a specific key in local storage is updated.