【发布时间】:2015-06-23 07:10:49
【问题描述】:
我有一个简单的 html 网页,猜测主页域是 mainDomain.com 。
这个网页包含<iframe id="a1" src="http://crossdomain.com/page1.htm">标签,这个<iframe>标签src是跨域的。
<iframe id="a1" src="http://crossdomain.com/page1.htm"> 包含另外一个 <iframe> 标记,即 src <iframe id="a1" src="http://mainDomain.com/page2.html">
我想获取<iframe id="a1" src="http://crossdomain.com/page1.htm"> 的内容,使用主页或<iframe id="frame2">。
请帮助我,我该怎么做?
<!doctype>
<html>
<head></head>
<body>
<h1>hello world</h1>
<iframe src="http://crossdomain.com/page1.htm" id="frame1">
<h2 id="hader1" > hey dad </h2>
<iframe src="http://mainDomain.com/page2.html" id="frame2">
<p>this is second frame</p>
</iframe>
</iframe>
</body>
</html>
【问题讨论】:
-
不能跨域访问,除非可以control the other domain。
-
我想以任何方式做到这一点,请给我一个建议
-
You simply can't 与 JS。
-
使用服务器和类似 cURL 的东西下载服务器上的内容。大概就是这样,除非您编写浏览器扩展程序,否则浏览器不会授予您在浏览器中的访问权限。
标签: javascript html dom iframe