uses
MSHTML,
begin
WebBrowser.Navigate('about:blank');
while WebBrowser.ReadyState<READYSTATE_INTERACTIVE do
Application.ProcessMessages;
(WebBrowser.Document as IHTMLDocument2).body.innerText:='';
(WebBrowser.Document as IHTMLDocument2).parentWindow.execScript(
'var r=Math.sqrt(9)+7; document.write(r+"<br>");', 'javascript'
);
Memo.Lines.Insert(0, (WebBrowser.Document as IHTMLDocument2).body.innerText);
end;