3

我在子窗口中弹出了第 3 方网站。我可以从父窗口引用它的 DOM 对象吗?我怎样才能做到这一点?

4

2 回答 2

0

简单的答案:

您不能违反 SOP 期间。

漏洞是使用 parent.parent 方案,其中至少请求属性是通过同一来源进行的:

根据内容调整 iframe 的大小

于 2012-11-29T18:45:41.387 回答
0
 childWindow = window.open ("http://www.yourDomain.com","mywindow");

  childWindow.onload = function () {
     childDocument = childWindow.document;
     // now you can do things like, childDocument.getElementById("someElement"); and other DOM manipulation.

    };
于 2012-11-29T18:48:14.057 回答