3 ms·
>Is it possible to send messages between the tabs? Save objects to local storage: localStorage.name = "dang"; alert(localStorage.name);
by pcmaffey 10y ago
>Is it possible to send messages between the tabs?
Save objects to local storage:
localStorage.name = "dang";
alert(localStorage.name);
- jakub_g 10y agoyes, the localstorage is the way to go You save stuff to localstorage in one tab, and in other tab you listen to "storage" event: window.addEventListener('storage', function() {..}) [0] https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage... [1] https://developer.mozilla.org/en-US/docs/Web/Events/storage https://developer.mozilla.org/en-US/docs/Web/Events/storage Another option is shared web workers, though I never used it. [2] http://stackoverflow.com/questions/12107424/communication-between-browser-tab http://stackoverflow.com/questions/12107424/communication-be... [3] https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker https://developer.mozilla.org/en-US/docs/Web/API/SharedWorke... I confused things in my other comment (I deleted it)
- johnsonjo 10y agoAlso something that could be promising depending on the circumstances you could use a shared webworker. They allow you to share a webworker script across multiple tabs. I think you have to be from the same domain, but I assume that you have to do that for local storage.