开发者

Saving webpage content using webbrowser IHTMLDocument interface

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 i开发者_Python百科mage files please help us with methods that internet explorer or firefox used to save the web page locally.

Thanks, Ramanand.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜