[英]find parent of the opener iframe
lets say we have an iframe in page test1.html 假设我们在页面test1.html中有一个iframe
<iframe src=test2.html"></iframe>
and there is a link in test2.html: 并且test2.html中有一个链接:
<a href="test3.html" target="_blank">open in new window"</a>
in test3.html how can I know the parent of the opener? 在test3.html中,我如何知道开启者的父级? (that is test1.html)
(即test1.html)
Something like window.opener.top
should get you the window object of the parent. 像
window.opener.top
这样的东西应该是你的父窗口对象。 From there you can get .location.href
, or whatever you need. 从那里你可以得到
.location.href
,或者你需要的任何东西。 Keep in mind that browser restrictions will cause this to fail if any of the documents are on different domains. 请记住,如果任何文档位于不同的域上,浏览器限制将导致此操作失败。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.