DocumentComplete Event

Fires when a document is completely loaded and initialized.

Syntax

        Private Sub object_DocumentComplete( _
	ByVal pDisp As Object, _
	ByVal URL As Variant)

Parameters

object
Object expression that resolves to the objects in the Applies To list.
pDisp
Object that specifies the top-level or frame WebBrowser object corresponding to the event.
URL
String that specifies the URL, Universal Naming Convention (UNC) file name, or pointer to an item identifier list (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 http://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.

Applies To

InternetExplorer, WebBrowser

See Also

Community Additions

Show: