IWebBrowser2::Navigate2 Method

Navigates the browser to a location that might not be expressed as a URL, such as a pointer to an item identifier list (PIDL) for an entity in the Windows Shell namespace.


HRESULT Navigate2(
    VARIANT *Flags,
    VARIANT *TargetFrameName,
    VARIANT *PostData,
    VARIANT *Headers


  • URL
    [in] A pointer to a VARIANT that evaluates to the URL of the resource to display, the full path to the file location, or a PIDL that represents a folder in the Shell namespace.
  • Flags
    [in] A pointer to a VARIANT of type VT_I4 or VT_I2 that specifies a combination of the values defined by the BrowserNavConstants enumeration.
  • TargetFrameName
    [in] A pointer to a case-sensitive string that contains the name of the frame in which to display the resource. The possible values for this parameter are.
    • _blank
      Load the link into a new unnamed window.
    • _parent
      Load the link into the immediate parent of the document the link is in.
    • _self
      Load the link into the same window the link was clicked in.
    • _top
      Load the link into the full body of the current window.
    • WindowName
      A named HTML frame. If no frame or window exists that matches the specified target name, a new window is opened for the specified link.
  • PostData
    [in] A pointer to a VARIANT of type VT_ARRAY|VT_UI1 that is sent to the server as part of a HTTP POST transaction. A POST transaction typically is used to send data collected by an HTML form. If this parameter does not specify any POST data, this method issues an HTTP GET transaction. This parameter is ignored if URL is not an HTTP (or HTTPS) URL.
  • Headers
    [in] A pointer to a VARIANT of type VT_BSTR that contains additional HTTP headers to send to the server. These headers are added to the default Windows Internet Explorer headers. For example, headers can specify the action required of the server, the type of data being passed to the server, or a status code. This parameter is ignored if the URL is not an HTTP (or HTTPS)  URL.

Return Value

Returns one of the following values.

S_OK The operation was successful.
E_INVALIDARG One or more parameters are invalid.
E_OUTOFMEMORY Out of memory.
E_FAIL The operation failed.


See IWebBrowser2::Navigate for additional usage notes.

This method extends the IWebBrowser2::Navigate method to allow for Shell integration; however, this method does not make IWebBrowser2::Navigate obsolete. The original method can still be used for URL navigations.

See Also

DWebBrowserEvents2::BeforeNavigate2, DWebBrowserEvents2::NavigateComplete2, IWebBrowser2::Navigate