【发布时间】:2019-02-26 19:05:39
【问题描述】:
我能够将用户导航从在 IFrame 中打开的外部网站捕获到一个变量中,并且我能够在控制台中显示该位置。但我想将所有用户导航捕获到数组或文本文件中。请帮我解决一下这个。下面是我的代码。
<html>
<head>
<title>test page</title>
</head>
<body>
<li><a href="http://mysmallwebpage.com/" target="iframe_a">Small Page</li>
<iframe id = "frame" src="" name="iframe_a" onload ="loadImage()" width = 100% height = 100% style="border:none;"></iframe>
</body>
<script>
function loadImage()
{
test = document.getElementById("frame").contentWindow.location;
console.log(test);
}
</script>
</html>
脚本中的变量“TEST”持有导航链接。我只想捕获某个数组或文件中的所有导航。请使用控制台测试代码了解我的要求。
【问题讨论】:
标签: javascript html iframe postmessage cross-domain-policy