使用网络浏览器 IHTMLDocument 接口保存网页内容

发布于 2024-08-14 04:03:14 字数 248 浏览 4 评论 0原文

我们需要使用 ATL webbrowser (IHTMLDocument) 控件保存完整的网页,包括 img、javascript、css 和 html,

使用 IHTMLDocument2::get_all() 方法我们已经保存了 .html 文件,但现在我们如何获取外部文件,例如 .css 、javascript 和图像文件 请帮助我们了解 Internet Explorer 或 Firefox 用于在本地保存网页的方法。

谢谢, 拉马南德.

We need to save the complete web page including img, javascript, css and html using ATL webbrowser (IHTMLDocument) control,

using IHTMLDocument2::get_all() method we have saved .html file but now how do we get external files such as .css, javascript and image files
please help us with methods that internet explorer or firefox used to save the web page locally.

Thanks,
Ramanand.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不即不离 2024-08-21 04:03:14

我认为这将是一项相当手动的任务:

您可以使用 IHTMLDocument2::styleSheets 属性来控制样式表。该集合包含 IHTMLStyleSheet 元素,这些元素又具有可用于下载文件的 href 属性。您可以通过 IHTMLDocument2::scripts 获取脚本,它为您提供一个包含 IHTMLScript 元素的集合,这些元素具有 src 属性。图像也是如此:使用 src 属性获取路径。有人似乎做了和你一样的事情,看看 此处。还有一些关于处理相对路径的提示。

I think this will be a rather manual task:

You can get a grip on the stylesheets by using the IHTMLDocument2::styleSheets property. The collection contains IHTMLStyleSheet elements, which in turn have a href-property which you can use to download the file. Scripts you can get via IHTMLDocument2::scripts which gives you a collection containing IHTMLScript elements, which have a src property. Same goes for images: use the src property to obtain a path. Somebody seems to do the same thing as you, have a look here. There are also some hints about handling relative pathes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文