【发布时间】:2011-12-23 13:10:30
【问题描述】:
我在 AIR 桌面应用程序中有一个 mx:html 组件,该组件将外部网页加载到其中...
此网页中有一个 iframe,并且 iframe 加载(显然)另一个页面...
我不知道如何获取 iframe 的代码...
如果我尝试获取网页内容,我只会检索起始页,例如:
文件webpage.html
<html>
<!-- html code-->
<iframe src="http://host/framepage.html">content default</iframe>
<!-- other html code-->
</html>
文件framepage.html
<div>test test test</div>
我想得到字符串<div>test test test</div>
请告诉我有一种方法可以获取 iframe 的内容(无需重新加载)...
编辑
查看Exort的回复,使用
var iFrame:* = domWindow.document.getElementById("myIframe");
将返回 iframe,但内容不是我想要的... 使用上面我的网页和 framepage 示例,我将获得的 iframe 内容是
content default
而不是
<div>test test test</div>
就像第二个页面没有加载,但它实际上是在浏览器窗口中加载和呈现的(我也尝试使用一个按钮,这样我可以延迟搜索 iframe 内容。
【问题讨论】:
-
iframe 是否与父项目位于完全相同的域中?
标签: xml apache-flex iframe air html-parsing