문제

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