最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Window to Window Communication in js by window name - Stack Overflow

programmeradmin6浏览0评论

Is there anyone who can give me some thoughts on how to handle window to window munication 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.

Is there anyone who can give me some thoughts on how to handle window to window munication 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.

Share Improve this question edited Jan 4, 2011 at 2:05 Dhaust 5,5509 gold badges55 silver badges81 bronze badges asked Jan 4, 2011 at 1:35 user561978user561978 411 silver badge2 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

assuming the following:

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();

and from the document inside the new window to the window that opened the new window, using the opener-property:

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

评论列表(0)

  1. 暂无评论