Reputation: 83
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.
Upvotes: 6
Views: 1865
Reputation: 18995
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
Upvotes: 6
Reputation: 7279
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.
Upvotes: 0