Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How send signals (trigger events) through all browser tabs using JS or JQuery/JS framework?

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.

like image 745
ArtNazarov Avatar asked Mar 05 '14 18:03

ArtNazarov


1 Answers

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

like image 175
kevingessner Avatar answered Oct 30 '22 08:10

kevingessner