Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function TForm1.GetDocument(pdisp : IDispatch) : IHTMLDocument2;
var
Browser : IWebBrowser2;
begin
Browser := pDisp as IWebBrowser2;
while Browser.Busy do // nothing;
Result := Browser.Document as IHTMLDocument2;
end;
function TForm1.GetHTML(Doc : IHTMLDocument2) : AnsiString;
var
Col : IHTMLelementCollection;
Ele : IHTMLelement;
begin
Result := '';
Col := Doc.All.Tags('HTML') as IHTMLelementCollection;
Ele := Col.Item(0, '') as IHTMLelement;
if Ele <> Nil
then Result := Ele.OuterHTML;
end;
procedure TForm1.Browser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch;
var URL: OleVariant);
var
Doc : IHTMLDocument2;
Txt : AnsiString;
begin
// Rememeber DocumentComplete is fired in every completed
// frame and may be this is not what you need.
// (pDisp as IUnknow) = (Browser1.ControlInterface as IUknown)
// will tell you what is going on.
Doc := GetDocument(pDisp);
Txt := GetHTML(Doc);
// Process the text here.
end;