Mirror

Append HTML Text to a TWebbrowser Document (Views: 771)

Problem/Question/Abstract:

How to append HTML Text to a TWebbrowser Document?

Answer:

uses
MSHTML;

procedure TForm1.Button1Click(Sender: TObject);
var
Range: IHTMLTxtRange;
begin
Range := ((WebBrowser1.Document as IHTMLDocument2).body as
IHTMLBodyElement).createTextRange;
Range.collapse(False);
Range.pasteHTML('
Hello!');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Webbrowser1.Navigate('www.google.ch');
end;


<< Back to main page