【发布时间】:2017-11-07 09:22:16
【问题描述】:
一段时间以来,我一直在尝试从 iframe 标记获取 html 源代码,但遗憾的是我仍然失败了。我的环境在 chrome 浏览器下,并带有 dom-distiller 扩展,它为我提供了从网页中提取主要文章的功能。此扩展适用于以下代码。
<iframe id="dom-distiller-result-iframe"
src="chrome-extension://oiembdaoobijmdmeobkalaehgifealpl/external/chromium/src/components/dom_distiller/core/html/dom_distiller_viewer.html"
style="z-index: 2147483647; position: fixed;
left: 0px; right: 0px; top: 0px; bottom: 0px;
margin: auto; width: 100vw; height: 100vh; background: white; border: none;">
</iframe>
它在我看到的网页中注入了一些 iframe 标签。使用这个 iframe 标签,可以在没有 AD 的情况下完美呈现精炼文档。我想我是否可以访问 id 为“dom-distiller-result-iframe”的 iframe 标签并获得渲染的 html 源代码。但是,我尝试了很多方法,但没有一个不起作用。
谁能给我一些建议?
【问题讨论】:
标签: javascript jquery html extraction