问题描述
如何检查时,web浏览器已全部完成?这code不重AJAX网站的工作。这将触发之前该网站已经真正完成,因此返回HTML code,而JavaScript是仍在运行。
我需要检查时,该网站是全面完成。这code与 http://www.html5test.com
测试 程序Browser_DocumentComplete(ASender:TObject的;
常量pDisp:IDispatch接口; VAR URL:OleVariant);
变种
CurWebrowser:IWebBrowser;
TopWebBrowser:IWebBrowser;
文件:OleVariant;
WindowName:字符串;
开始
CurWebrowser:= pDisp为IWebBrowser;
TopWebBrowser:=(ASender作为TEmbeddedWB).DefaultInterface;
如果(CurWebrowser = TopWebBrowser),而不是Browser.Busy和(Browser.ReadyState> = READYSTATE_COMPLETE),然后开始
FDocumentLoaded:= TRUE;
结束;
结束;
一个网页,它使用Ajax是由浏览器加载并执行JavaScript来更新/修改其内容。
客户端不知道什么时候是全面完成状态已经达到。一些JavaScript的方法可能会延迟一段时间后运行,或定期。
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.
这篇关于如何检查web浏览器完成全部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!