Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>Is it possible to send messages between the tabs?

Save objects to local storage:

localStorage.name = "dang";

alert(localStorage.name);



yes, 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...

[1] 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-be...

[3] https://developer.mozilla.org/en-US/docs/Web/API/SharedWorke...

I confused things in my other comment (I deleted it)


Also 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.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: