如何使用JS或JQuery / JS框架通过所有浏览器选项卡发送信号(触发事件)? [英] How send signals (trigger events) through all browser tabs using JS or JQuery/JS framework?

查看:62
本文介绍了如何使用JS或JQuery / JS框架通过所有浏览器选项卡发送信号(触发事件)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在浏览器中有很多打开的网站标签。我如何通过所有这些发送信号(触发事件),也许有人知道关于那个的好文章/博客?示例:在一个选项卡中,我将登录该站点,几秒钟后,必须更改其他选项卡中的用户界面。执行此案例有哪些建议是最佳做法
对不起英语不好,我不是母语。

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.

推荐答案

你可以用 localStorage ,浏览器中的数据存储,在所有选项卡中共享/正在查看同一域的窗口。当任何选项卡进行存储更改时,会在所有选项卡中触发存储事件。这里有一个演示: http://html5demos.com/storage-events

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

这篇关于如何使用JS或JQuery / JS框架通过所有浏览器选项卡发送信号(触发事件)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆