从另一个在一个页面上执行JavaScript [英] Execute javascript on one page from another

查看:190
本文介绍了从另一个在一个页面上执行JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  <一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?

推荐答案

您只能这样做,如果:


  1. 一个标签中的其他打开。

  2. 这两个页​​面来自同一个域提供服务。

揭幕战标签只需要存储一个参考窗口对象由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屋!

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