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

jquery - How to access child window from parent window through javascript? - Stack Overflow

programmeradmin0浏览0评论

Suppose we open a popup through javascript when a link is clicked on parent window.

As everybody knows that parent window elements can be accessed from child window using the window.opener() function.

Is it possible to do exactly reverse ? Can parent window access the information about the child window ?

Suppose we open a popup through javascript when a link is clicked on parent window.

As everybody knows that parent window elements can be accessed from child window using the window.opener() function.

Is it possible to do exactly reverse ? Can parent window access the information about the child window ?

Share Improve this question asked Sep 19, 2013 at 9:11 Kshitij JainKshitij Jain 1,7935 gold badges20 silver badges30 bronze badges 2
  • Please check other similar questions on stackoverflow before asking... Solution has already been given 1000 times... – Yann39 Commented Sep 19, 2013 at 9:19
  • There is no similar question on stackoverflow for this one. – Kshitij Jain Commented Sep 19, 2013 at 9:21
Add a comment  | 

2 Answers 2

Reset to default 7

You mean something like this:

a=window.open()
a.document.write("<div id='mydiv'>test</div>")
a.document.getElementById("mydiv")

When you open a window through javascript's window.open() function it returns you a reference of the child window.

Using this reference you can access elements of the child window, required it complies with Same origin policy security requirements.

发布评论

评论列表(0)

  1. 暂无评论