Occurs when the WebBrowser control is about to navigate to a different URL, which may happen as a result of external automation, internal automation from a script, or the user clicking a link or typing in the address bar. The container has an opportunity to cancel the pending navigation.
Syntax
Private Sub object_BeforeNavigate2(ByVal pDisp As Object, ByVal URL As String, ByVal Flags As Long, ByVal TargetFrameName As String, PostData As Variant, ByVal Headers As String, Cancel As Boolean)
Parameters
- object
- Required. An object expression that evaluates to an object in the Applies To list.
- pDisp
- An object that evaluates to the top-level or frame WebBrowser object corresponding to the navigation.
- URL
- A string expression that evaluates to the URL to which the browser is navigating.
- Flags
- Reserved for future use.
- TargetFrameName
- A string expression that evaluates to the name of the frame in which the resource will be displayed, or NULL if no named frame is targeted for the resource.
- PostData
- Data to send to the server if the HTTP POST transaction is being used.
- Headers
- A value that specifies the additional HTTP headers to send to the server (HTTP URLs only). The headers can specify things like the action required of the server, the type of data being passed to the server, or a status code.
- Cancel
- A Boolean value that the container can set to TRUE to cancel the navigation operation, or to FALSE to allow it to proceed.
Applies To
InternetExplorer, WebBrowser
See Also
Navigate, Navigate2, NavigateComplete2