【发布时间】:2014-01-04 20:09:53
【问题描述】:
我正在尝试读取通过window.open 加载的文档的内容:
<!DOCTYPE html>
<html>
<body>
<button onclick="openWin()">Open "newWindow" and read its content</button>
<script>
var myWindow;
function openWin() {
myWindow = window.open("http://www.google.com/",
"myWindow", "width=400, height=400");
myWindow.opener.document.write(myWindow.document.body.innerHTML);
}
</script>
</body>
</html>
如何在通过window.open 加载文档后读取其内容?
我已经用setTimeout 函数尝试过这个,但它没有用。
这是有效的:
myWindow.opener.document.write("Done!!");
【问题讨论】:
标签: javascript popup window