直接写入HTML字符串到WebBrowser控件中
uses mshtml , ActiveX , ComObj ;
procedure TForm1 . Button1Click ( Sender : TObject );
var
v : Variant ;
HTMLDocument : IHTMLDocument2 ;
begin
WebBrowser1 . Navigate ( 'about:blank' );
HTMLDocument := WebBrowser1 . Document as IHTMLDocument2 ;
v := VarArrayCreate ([ 0 , 0 ], varVariant );
v [ 0 ] := '<HTML><h1>Test</h1><br>aaaaaa</html>' ; // Here's your HTML string
HTMLDocument . Write ( PSafeArray ( TVarData ( v ). VArray ));
HTMLDocument . Close ;
end ;