Mega Code Archive

 
Categories / Delphi / Graphic
 

How to save raw HTML source from and all depent files (.CSS, JPG, GIF Etc..) with TWebBrowser

Title: How to save raw HTML source from and all depent files (.CSS, JPG, GIF Etc..) with TWebBrowser Question: An earlier article showed a way to import raw HTML from the Webbrowser control, but most web pages also contain graphic files, style sheets etc. The Webbrowser or TWebbrowser contains methods that allow you to perform the exact same functionality as used by IE (MSDN contains all of them). Below is an example on the importing of a web page and all it's graphic dependencies to a user supplied directory. Also without your own code, IE will display a AVI and a progress bar depicting the percentage copied. Answer: Note: Make sure the TWebbrowser has navigated to a valid web page and then do the following. try WebBrowser1.ExecWB(4, 0); except on E: Exception do msError:=true; end; Tada. .