質問

How to check when WebBrowser has fully completed? This code doesn't work for heavy AJAX websites. It will fire before the site has really completed and thus return HTML code while javascript is still running.

I need to check when the website is FULLY completed. This code was tested with http://www.html5test.com

procedure Browser_DocumentComplete(ASender: TObject;
  const pDisp: IDispatch; var URL: OleVariant);
var
  CurWebrowser: IWebBrowser;
  TopWebBrowser: IWebBrowser;
  Document: OleVariant;
  WindowName: string;
begin
  CurWebrowser := pDisp as IWebBrowser;
  TopWebBrowser := (ASender as TEmbeddedWB).DefaultInterface;
  if (CurWebrowser = TopWebBrowser) and not Browser.Busy and (Browser.ReadyState >= READYSTATE_COMPLETE) then begin
    FDocumentLoaded:=True;
    end;
end;
役に立ちましたか?

解決

A web page which uses Ajax is loaded by the browser and executes JavaScript to update / modify its content.

The client does not know when a "fully completed" state has been reached. Some JavaScript methods might run after a delay, or periodically.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top