6

I have many open tabs of my website in browser. How I can send signals (trigger events) through all of them, maybe somebody knows good article/blogpost about that? Example: in one tab I will be login to the site, after some seconds user interface in other tabs must be changed. What advice is best practice to perform this case? Sorry for bad English language, I'm not native speaker.

1
  • Object.observe (on chrome) and session storage maybe. But would be better to use websockets on a server for that.
    – mpm
    Mar 5, 2014 at 18:15

2 Answers 2

6

You can use localStorage, a data store in the browser that's shared among all tabs/windows that are viewing the same domain. There's a storage event that is triggered in all tabs when any tab makes a storage change. There's a demo here: http://html5demos.com/storage-events

0

What you should do is have your server handle that. (e.g. you notify your server when you login and your server tells communicates tot the other opened tabs). NodeJS and websockets can do that easily but that depends on what you use/ are comfortable with for your server language.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.