7 out of 21 rated this helpful - Rate this topic

Navigate Method

Navigates to a resource identified by a URL or to a file identified by a full path.

Syntax

        object.Navigate( _
    url As String, _
    [Flags As Variant,] _
    [TargetFrameName As Variant,] _
    [PostData As Variant,] _
    [Headers As Variant])

Parameters

url
Required. A String expression that evaluates to the URL, full path, or Universal Naming Convention (UNC) location and name of the resource to display.
Flags
Optional. A constant or value that specifies a combination of the values defined by the BrowserNavConstants enumeration.
TargetFrameName
Optional. A 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
Optional. Data that is sent to the server as part of a HTTP POST transaction. A POST transaction is typically used to send data gathered 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 the URL is not an HTTP URL.
Headers
Optional. A String 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 URL.

Remarks

The WebBrowser control or InternetExplorer object can browse to any location in the local file system, on the network, or on the World Wide Web.

In Microsoft Internet Explorer 6 or later, you can navigate through code only within the same domain as the application hosting the WebBrowser control. Otherwise, this method and Navigate2 are disabled.

In Internet Explorer 7, when you specify the navOpenInNewTab flag or the navOpenInBackgroundTab flag, do not combine them with other parameters ( TargetFrameName, PostData, Headers) or with other BrowserNavConstants flags. If tabbed browsing is disabled, or if a tab cannot be created, the call will fail. If this happens, choose another navigation method, such as navOpenInNewWindow.

Note    New tabs are opened asynchronously; this method returns as soon as the tab is created, which can be before navigation in the new tab has started. The IWebBrowser2 object for the destination tab is not available to the caller. Tab order is not guaranteed, especially if this method is called many times quickly in a row.

When navOpenInNewWindow or navOpenInNewTab is specified, the caller does not receive a reference to the WebBrowser object for the new window, so there is no immediate way to manipulate it.

Applies To

InternetExplorer, WebBrowser

See Also

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
What happens "if it fails"
Doc says If tabbed browsing is disabled, or if a tab cannot be created, the call will fail. If this happens, choose another navigation method, such as navOpenInNewWindow Ok so what is return value if it fails. Who writes this documentation?? I suppose its likely Error_Success/Fail =0/1 but why such lousy documentation?
I cann't send a POST Request with HTTPS
POST data in this Script are not includet in Request - the IE is navigated only with URL, but i need HTTPS with POST data. Cann i send it in VBScript? HOW?

Dim IE
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "https://website/order.do", , ,"d=123" , "Content-Type: application/x-www-form-urlencoded"

[tfl - 04 01 12] Hi - and thanks for your post. Community content is not the appropriate place for technical support queries. Instead,
you should visit the Technet Forums at http://forums.microsoft.com/technet, where such posts are welcomed and where you stand a much
better chance of getting your query resolved. Sorry if that's not the answer you wanted to hear.

POST with HTTPS
Hello,
how I cann send a Request with HTTPS URL? I have this Script:
Dim IE
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate https://web/something.php, , ,"something=5" , "Content-Type: application/x-www-form-urlencoded"

The POST data "something=5" are not transported to the web. How i cann send POST with HTTPS protocol?

Thanks

[tfl - 04 01 12] Hi - and thanks for your post. Community content is not the appropriate place for technical support queries. Instead,
you should visit the Technet Forums at http://forums.microsoft.com/technet, where such posts are welcomed and where you stand a much
better chance of getting your query resolved. Sorry if that's not the answer you wanted to hear.

NTLM?
How do i use this method with NTLM authorization?

[tfl - 04 01 12] Hi - and thanks for your post. Community content is not the appropriate place for technical support queries. Instead,
you should visit the Technet Forums at http://forums.microsoft.com/technet, where such posts are welcomed and where you stand a much
better chance of getting your query resolved. Sorry if that's not the answer you wanted to hear.

VBScript: Type conversion of the "Flags" variable

I realized that the "Flags" variable needed to be a VT_I4 type, and this is not done automatically in VB/VBScript, so you have to do a manual conversion with the CLng function, I.E.:

const navOpenInNewTab = &h0800
Set oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = True
oIE.Navigate "http://msdn.microsoft.com", CLng(navOpenInNewTab)

If you don't convert it, it'll be ignored, and you'll be left without a clue as to what went wrong.

-- Good catch! Apparently, only VT_I4 is recognized by the InternetExplorer automation object. If you are using the WebBrowser control, both VT_I2 (Integer) and VT_I4 (Long) types are supported. (jsudds)

-- Thanks for pointing this out. You saved me from getting desperate (billy)

"Flags" variable?
Speaking of the "Flags" variable... where is it in this documentation? I thought it was the 2nd parameter, but I don't see it here. I know it's supposed to be there because the "Headers" variable won't work unless it's the 5th parameter. Am I missing something or is the documentation missing something?