interface ICoreWebView2NavigationStartingEventArgs

Note

This reference is no longer being maintained. For the latest API reference, see WebView2 API Reference.

interface ICoreWebView2NavigationStartingEventArgs
  : public IUnknown

Event args for the NavigationStarting event.

Summary

Members Descriptions
get_Cancel The host may set this flag to cancel the navigation.
get_IsRedirected TRUE when the navigation is redirected.
get_IsUserInitiated TRUE when the navigation was initiated through a user gesture as opposed to programmatic navigation by page script.
get_NavigationId The ID of the navigation.
get_RequestHeaders The HTTP request headers for the navigation.
get_Uri The uri of the requested navigation.
put_Cancel Sets the Cancel property.

Applies to

Product Introduced
WebView2 Win32 0.9.430
WebView2 Win32 Prerelease 0.9.488

Members

get_Cancel

The host may set this flag to cancel the navigation.

public HRESULT get_Cancel(BOOL * cancel)

If set, the navigation is not longer present and the content of the current page is intact. For performance reasons, GET HTTP requests may happen, while the host is responding. You may set cookies and use part of a request for the navigation. Navigations to about schemes are cancellable, unless msWebView2CancellableAboutNavigations feature flag is disabled. Cancellation of frame navigation to srcdoc is not supported and wil be ignored. A cancelled navigation will fire a NavigationCompleted event with a WebErrorStatus of COREWEBVIEW2_WEB_ERROR_STATUS_OPERATION_CANCELED.

get_IsRedirected

TRUE when the navigation is redirected.

public HRESULT get_IsRedirected(BOOL * isRedirected)

get_IsUserInitiated

TRUE when the navigation was initiated through a user gesture as opposed to programmatic navigation by page script.

public HRESULT get_IsUserInitiated(BOOL * isUserInitiated)

Navigations initiated via WebView2 APIs are considered as user initiated.

get_NavigationId

The ID of the navigation.

public HRESULT get_NavigationId(UINT64 * navigationId)

get_RequestHeaders

The HTTP request headers for the navigation.

public HRESULT get_RequestHeaders(ICoreWebView2HttpRequestHeaders ** requestHeaders)

Note

You are not able to modify the HTTP request headers in a NavigationStarting event.

get_Uri

The uri of the requested navigation.

public HRESULT get_Uri(LPWSTR * uri)

The caller must free the returned string with CoTaskMemFree. See API Conventions.

put_Cancel

Sets the Cancel property.

public HRESULT put_Cancel(BOOL cancel)