从Android WebView获取iframe数据
Getting iframe data from Android WebView
我有一个网页,其中包含一个iframe:
<div id="confIMG" style="display:block;">
<iframe id="ifrmy" src="http://www.example.com" style="margin:0;padding:0;border:0;overflow:hidden;height:200px;width:90%;'" scrolling="no">
</iframe>
#document
<!DOCTYPE html>
<html>
<head>....</head>
<body>....</body>
</html>
</div>
为了获得所有的html源代码,我使用了以下javascript:
javascript:HTMLOUT.processHTML(document.documentElement.outerHTML);
但是,当监听器被调用时,我只看到:
<div id="confIMG" style="display:block;">
<iframe id="ifrmy" src="http://www.example.com" style="margin:0;padding:0;border:0;overflow:hidden;height:200px;width:90%;'" scrolling="no">
</iframe>
</div>
问题是所有iframe文档都被遗漏了。我怎样才能把它们都拿到?
我还尝试使用JSOUP获取该页面。在这种情况下,我只得到:
<div id="confIMG" style="display:block;"></div>
附言:我试着用Chrome浏览器查看。当我在选项卡elements
中使用developer options / developers tools
时,我只能看到源代码。
JSoup不会自动获取iframe内容,如果您不要求它这样做。
当您第一次加载页面时,找到iframe,然后用Jsoup获取它。
Document doc=...
Element ifrmy = doc.select("#ifrmy").first();
if (ifrmy!=null) {
Document iframeContent = Jsoup.connect(ifrmy.attr("src")).get();
// ...
}
相关文章:
- 将数据发布到iframe(aspx)以在aspx页面的页面加载中捕获它
- 将数据发布到iframe是同步还是异步
- 如何在 iframe 中创建 HTML5 数据属性
- 如何将数据从注入的内容脚本传递到iframe
- 在带有数据的iframe中的JSONP中没有回调
- Iframe从父级获取/发布数据
- 传递数据 id 以引导模式并使用它 iframe url
- 如何将 iframe 数据传递到父窗口
- 带有 iframe 的多部分/表单数据
- Iframe 数据从父页面发布,如果服务器上发生异常,则重新加载父页面
- 使用 Jquery 将输入数据发送到 iframe 之外
- 在具有跨源的 iframe 中设置数据属性值
- 如何使用 jQuery 从父窗口中的 iframe 访问数据
- 是否可以在没有 Cookie 数据的情况下创建 iframe
- 从 iframe 访问数据
- Facebook是否可以获取用户的数据并在iframe中填充表单
- 从 iFrame 中每个页面上的 iFrame URL 获取数据
- iframe数据未正确打印
- 从Android WebView获取iframe数据
- 将Iframe数据拆分为不同的变量