从另一个在一个页面上执行JavaScript [英] Execute javascript on one page from another
问题描述
可能重复:结果
<一href=\"http://stackoverflow.com/questions/4079280/javascript-communication-between-browser-tabs-windows\">Javascript浏览器标签之间的通信/窗口
我提供限制是浏览器的能力和我有两个网页,是否有可能写javascript在一个改变标签和另一页?
Providing my limitations are the abilities of the browser and I have two web pages, is it possible to write javascript on one that changes tabs and executes some javascript on another page?
有没有办法为两个选项卡到服务器以外的彼此沟通?
Is there any way for two tabs to communicate to each other outside the server?
推荐答案
您只能这样做,如果:
- 一个标签中的其他打开。
- 这两个页面来自同一个域提供服务。
揭幕战标签只需要存储一个参考窗口对象由window.open()的返回,而新的标签可以通过window.opener引用父。
The opener tab just needs to store a reference to the window object returned from window.open(), and the new tab can reference the parent through window.opener.
这篇关于从另一个在一个页面上执行JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!