通过窗口名称在js中进行窗口到窗口通信 [英] Window to Window Communication in js by window name

查看:116
本文介绍了通过窗口名称在js中进行窗口到窗口通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人可以给我一些关于如何使用javascript来处理窗口到窗口通信的想法,因为两个窗口没有父子关系。基本上,其他窗口是使用window.open方法打开的。任何出色的信息都将受到赞赏。

Is there anyone who can give me some thoughts on how to handle window to window communication using javascript givin that the two windows has no parent child relationship. Basically the other window is opened using window.open method. Any brilliant information is well appreciated.

推荐答案

假定以下内容:

windowHandle=window.open('path/to/document');

您可以在两个窗口之间进行交互。

you can interact between both windows.

您可以使用变量名指向打开文档的窗口对象的指针:

You have a pointer to the window-object from the document where it was opened from using the variable-name:

//doSomething has to be known inside the new window
windowHandle.doSomething();

,然后使用<$从新窗口内的文档到打开新窗口的窗口c $ c>开瓶器-属性:

//doSomething has to be known inside the window that opened the new window
opener.doSomething();

这篇关于通过窗口名称在js中进行窗口到窗口通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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