共用方式為


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.

Syntax

*object.*Navigate2(URL, Flags, TargetFrameName, PostData, Headers)

Parameters

URL [in]

Type: Variant

Required. A variable or expression 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, optional]

Type: Variant

A constant or value that specifies a combination of the values defined by the BrowserNavConstants enumeration.

TargetFrameName [in, optional]

Type: Variant

Case-sensitive string expression that evaluates to 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, optional]

Type: Variant

Data 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, optional]

Type: Variant

A String that contains additional HTTP headers to send to the server. These headers are added to the default 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

Type: Long

Returns one of the following values.

Return code Description
S_OK

The operation was successful.

E_INVALIDARG

One or more parameters are invalid.

E_OUTOFMEMORY

Out of memory.

E_FAIL

The operation failed.

 

Remarks

See Navigate for additional usage notes.

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

See also

InternetExplorer

WebBrowser

Reference

BeforeNavigate2

NavigateComplete2

Navigate