有没有人可以给我一些关于如何使用 javascript givin 处理窗口到窗口通信的想法,因为这两个窗口没有父子关系。基本上另一个窗口是使用 window.open 方法打开的。非常感谢任何精彩的信息。
最佳答案
假设如下:
windowHandle=window.open('path/to/document');
您可以在两个窗口之间进行交互。
从使用变量名打开它的文档中,您有一个指向窗口对象的指针:
//doSomething has to be known inside the new window
windowHandle.doSomething();
并从新窗口内的文档到打开新窗口的窗口,使用 opener
-property:
//doSomething has to be known inside the window that opened the new window
opener.doSomething();
关于javascript - 通过窗口名称在js中进行窗口到窗口通信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4589963/