Link to home
Start Free TrialLog in
Avatar of ralph44e
ralph44e

asked on

Get the HTML source without TWebBrowser

I am looking to get the HTML Source code from a page without opening it the tWebBrowser component. Mainly my problem is
that the TWebBrowser component is IE and certain problems occur in my program when I open a page

with a popup
or a javascript error
or a required plugin
or a auto-download

etc etc etc...

So I'm looking for a way to just get the HTML code without "executing" the HTML is this possible?
Avatar of geobul
geobul

Hi,

Try this:

uses URLMon;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if URLDownloadToFile(nil, 'http://www.experts-exchange.com', 'c:\Experts.html', 0, nil) <> 0 then
    MessageBox(Handle, 'Cannot download the file.', PChar(Application.Title), MB_ICONERROR or MB_OK);
end;

Regards, Geo
In the example above 'http://www.experts-exchange.com' is the link to the page for getting and 'c:\Experts.html' is the local file where the HTML source will be saved.
Hi,

You can use Internet Component Suite. Works like a charm and has good samples :-)

HTH,

Andrew
ASKER CERTIFIED SOLUTION
Avatar of SaLz
SaLz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial