DocumentComplete event

Fires when a document is completely loaded and initialized.

Syntax

HTML Attribute <element DocumentComplete = "handler(event)">
attachEvent Method object.attachEvent("DocumentComplete", handler)

 

Event information

Synchronous No
Bubbles No
Cancelable No

 

Event handler parameters

  • pDisp [in]

    C++ A pointer to the IDispatch interface of the window or frame in which the document is loaded. This IDispatch interface can be queried for the IWebBrowser2 interface.
    VB Object that specifies the top-level or frame WebBrowser object corresponding to the event.
  • URL [in]

    C++ A pointer to a Variant structure of type String that specifies the URL, UNC file name, or a PIDL of the loaded document.
    VB String that specifies the URL, UNC file name, or PIDL of the loaded document.

Remarks

The value of the URL parameter might not match the URL that was originally given to the WebBrowser Control, because the URL might be converted to a qualified form. For example, if an application specified a URL of www.microsoft.com in a call to the Navigate method or the Navigate2 method, then the URL passed into DocumentComplete is https://www.microsoft.com/. If the server has redirected the browser to a different URL, the redirected URL is passed into the URL parameter.

The WebBrowser Control fires the DocumentComplete event when the document has completely loaded, and the READYSTATE property has changed to READYSTATE_COMPLETE. Following are some important points about the firing of this event.

  • In pages with no frames, this event fires one time after loading is complete.
  • In pages where multiple frames are loaded, this event fires for each frame where the DownloadBegin event has fired.
  • This event pDisp parameter is the same as the IDispatch interface pointer of the frame in which this event fires.
  • In the loading process, the highest level frame, which is not necessarily the top-level frame, fires the final DocumentComplete event. At this time, the pDisp parameter is the same as the IDispatch interface pointer of the highest level frame.

For specific code examples using Microsoft Visual Basic and Microsoft Foundation Classes (MFC), see Knowledge Base article Q180366.

Currently, the DocumentComplete does not fire when the Visible property of the WebBrowser Control is set to false. For more information, see Knowledge Base Article Q259935.

See also

InternetExplorer

WebBrowser

Reference

BeforeNavigate2

Navigate

Navigate2

READYSTATE