简体   繁体   中英

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 image 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM