views:

298

answers:

1

Dear All,

We are downloading web page linked Images, style sheet(.css) and javascript files using web browser control (IWebbrowser2 and IHTMLDocument interface) ATL win32 application.

Now for some of the web page image src= "/images/a1.jpg" are relative, so we need to append a base host address to the location and download.

Do we have any method to get the base host address URL path to be append into image path. or any good parser to extract that?

Thanks, Ramanand Bhat.

+1  A: 

Does IWebBrowser2::LocationURL or IHTMLDocument2::URL not give you the base URL you need?

tyranid
Yes, it gives the complete browsed URL path, so from their we have to parse the base root location URL, which we are trying to avoid.
Ramanand Bhat
The use something like the UrlCombine function. If you pass it the base URL of say http://www.domain.com/somepath/something.htm and a relative path of /images/image.jpg it will return http://www.domain.com/images/image.jpg
tyranid