Partager via


createDocumentFromUrl method

Creates a new document object from an existing URL.

Syntax

HRESULT retVal = object.createDocumentFromUrl(bstrUrl, bstrOptions, oNewDoc);

Parameters

bstrUrl [in]

Type: BSTR

A BSTR that specifies the URL of the page from which to create the new document.

bstrOptions [in]

Type: BSTR

A BSTR that specifies the media type for applying media style sheets on creation of the document. It can be one of the following values.

print

Sets the media value for printing or print preview.

null

Ignores the media value.

oNewDoc [out, retval]

C++ A pointer to an IHTMLDocument2 interface that receives the newly created document.
JavaScript Returns the newly created document.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The page specified by bstrUrl is loaded asynchronously. The HTMLFrameSiteEvents::onload event is fired on the new document object when the Dynamic HTML (DHTML) object model is available.

See also

IHTMLDocument4::media