CWebView::GetNavigationStatus Method  
 
BOOL GetNavigationStatus(
  LPDWORD lpdwFlags,  
  LPDWORD lpdwError  
);

The GetNavigationStatus method returns the current navigation state.

Parameters

lpdwFlags
A pointer to an unsigned integer which may contain one of more status bitflags. This parameter may be NULL if the status flags are not required.
Name Description
WEBVIEW_NAVIGATION_REDIRECTED The navigation was the result of an HTTP redirect.
WEBVIEW_NAVIGATION_USER_INITIATED Navigation began from a user gesture rather than being initiated by a script.
WEBVIEW_NAVIGATION_LOCAL_DATA Content was served using local data rather than a full network fetch.
lpdwError
A pointer to a unsigned integer which will contain one of the following error codes. This parameter may be NULL if the error code is not required.
Name Description
WEBVIEW_ERROR_NONE No error.
WEBVIEW_ERROR_CERTIFICATE_COMMON_NAME Certificate common name mismatch.
WEBVIEW_ERROR_CERTIFICATE_EXPIRED Certificate is expired.
WEBVIEW_ERROR_INVALID_CLIENT_CERTIFICATE Invalid or untrusted client certificate.
WEBVIEW_ERROR_CERTIFICATE_REVOKED Certificate has been revoked.
WEBVIEW_ERROR_INVALID_CERTIFICATE Certificate is invalid for another reason.
WEBVIEW_ERROR_SERVER_UNREACHABLE Cannot reach the server/host.
WEBVIEW_ERROR_TIMEOUT Operation timed out.
WEBVIEW_ERROR_INVALID_SERVER_RESPONSE Server returned an invalid or unexpected response.
WEBVIEW_ERROR_CONNECTION_ABORTED Connection aborted by the server or network.
WEBVIEW_ERROR_CONNECTION_RESET Connection was reset.
WEBVIEW_ERROR_DISCONNECTED Disconnected during the operation.
WEBVIEW_ERROR_CANNOT_CONNECT Failed to establish a connection.
WEBVIEW_ERROR_HOST_NAME_NOT_RESOLVED DNS resolution failed for the host.
WEBVIEW_ERROR_OPERATION_CANCELED Operation was canceled by the user or host.
WEBVIEW_ERROR_REDIRECT_FAILED Redirection failed.
WEBVIEW_ERROR_UNEXPECTED_ERROR An unexpected error occurred.
WEBVIEW_ERROR_CREDENTIALS_REQUIRED Authentication credentials are required.
WEBVIEW_ERROR_PROXY_AUTHENTICATION_REQUIRED Proxy authentication is required.

Return Value

If the method succeeds, the return value is non-zero. If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The GetNavigationStatus method provides detailed information about the current state of navigation for the specified WebView instance. It can be used to determine if a navigation is still in progress, whether it completed successfully, or if it was canceled or failed due to an error condition. The status flags returned in lpdwFlags can be combined to indicate additional context about the navigation, such as whether it was initiated by the user, if the content was served from local data rather than fetched over the network, or if the navigation resulted from an HTTP redirect.

Developers may find this method most useful in the following situations:

  • After handling a WEBVIEW_EVENT_NAVIGATION_COMPLETED event, to check if the navigation was successful.
  • Before retrying or redirecting a failed request, to determine the specific cause of failure.
  • When logging diagnostic information about connectivity or certificate errors.
  • To distinguish between user-initiated cancellation, network timeouts, or security errors.
  • To detect when content was provided from local data rather than fetched remotely.

The error code returned in lpdwError provides additional detail when a navigation fails or is blocked. These values cover a wide range of conditions, including invalid or expired certificates, connectivity issues, unreachable hosts, proxy authentication failures, and other network-related problems. If lpdwError is WEBVIEW_ERROR_NONE, the most recent navigation completed without error.

When navigation involves local files or HTML provided directly to the browser via SetDocumentText, the method will typically return WEBVIEW_ERROR_NONE and may set WEBVIEW_NAVIGATION_LOCAL_DATA in the status flags. This allows the application to detect that the content was not fetched over the network.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cshtmv12.lib

See Also