Fires before a navigation occurs in the given WebBrowser (on either a window or frameset element).
Syntax
void BeforeNavigate2( IDispatch *pDisp, VARIANT *URL, VARIANT *Flags, VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers, VARIANT_BOOL *Cancel );
Parameters
- pDisp
- [in] Address of the IDispatch interface for the WebBrowser object that represents the window or frame. This interface can be queried for the IWebBrowser2 interface.
- URL
- [in] URL to be navigated to.
- Flags
- [in] Reserved for future use.
- TargetFrameName
- [in] String that contains the name of the frame in which to display the resource, or NULL if no named frame is targeted for the resource.
- PostData
- [in] Address of data to send to the server if the HTTP POST transaction is being used.
- Headers
- [in] Additional HTTP headers to send to the server (HTTP URLs only). The headers can specify things such as the action required of the server, the type of data being passed to the server, or a status code.
- Cancel
- [out] Address of a cancel flag. An application can set this parameter to TRUE to cancel the navigation operation, or to FALSE to allow it to proceed.
Return Value
No return value.
Remarks
The post data specified by PostData is passed as a SAFEARRAY structure. The variant should be of type VT_BYREF or VT_VARIANT, which points to a SAFEARRAY. The SAFEARRAY should be of element type VT_UI1, dimension one, and have an element count equal to the number of bytes of post data.
This event replaces the BeforeNavigate and FrameBeforeNavigate events, which should no longer be used. Microsoft® Internet Explorer 4.0 and Internet Explorer 5 will continue to fire the BeforeNavigate and FrameBeforeNavigate events for compatibility with Internet Explorer 3.0.
Providing the pDisp pointer of the corresponding WebBrowser object gives the host better information and control over the Internet Explorer 3.0 specification, which used FrameBeforeNavigate and a target frame name to identify the target of navigation (target frame names are not unique).
The pDisp parameter is that of the top-level or frame WebBrowser object corresponding to the navigation. The processing of this navigation can be modified by setting the Cancel parameter to TRUE and either ignoring or reissuing a modified navigation method to the WebBrowser object. The URL parameter can be a PIDL in the case of a shell namespace entity for which there is no URL representation.
Windows CE
Windows CE Use version 2.12 and later Minimum availability Internet Explorer 4.0
See Also
DWebBrowserEvents2::NavigateComplete2, IWebBrowser2::Navigate2