WebViewClient.OnReceivedSslError(WebView, SslErrorHandler, SslError) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Notify the host application that an SSL error occurred while loading a resource.
[Android.Runtime.Register("onReceivedSslError", "(Landroid/webkit/WebView;Landroid/webkit/SslErrorHandler;Landroid/net/http/SslError;)V", "GetOnReceivedSslError_Landroid_webkit_WebView_Landroid_webkit_SslErrorHandler_Landroid_net_http_SslError_Handler")]
public virtual void OnReceivedSslError (Android.Webkit.WebView? view, Android.Webkit.SslErrorHandler? handler, Android.Net.Http.SslError? error);
[<Android.Runtime.Register("onReceivedSslError", "(Landroid/webkit/WebView;Landroid/webkit/SslErrorHandler;Landroid/net/http/SslError;)V", "GetOnReceivedSslError_Landroid_webkit_WebView_Landroid_webkit_SslErrorHandler_Landroid_net_http_SslError_Handler")>]
abstract member OnReceivedSslError : Android.Webkit.WebView * Android.Webkit.SslErrorHandler * Android.Net.Http.SslError -> unit
override this.OnReceivedSslError : Android.Webkit.WebView * Android.Webkit.SslErrorHandler * Android.Net.Http.SslError -> unit
Parameters
- view
- WebView
The WebView that is initiating the callback.
- handler
- SslErrorHandler
An SslErrorHandler
that will handle the user's
response.
- error
- SslError
The SSL error object.
- Attributes
Remarks
Notify the host application that an SSL error occurred while loading a resource. The host application must call either SslErrorHandler#cancel
or SslErrorHandler#proceed
. Note that the decision may be retained for use in response to future SSL errors. The default behavior is to cancel the load.
This API is only called for recoverable SSL certificate errors. In the case of non-recoverable errors (such as when the server fails the client), WebView will call #onReceivedError(WebView, WebResourceRequest, WebResourceError)
with #ERROR_FAILED_SSL_HANDSHAKE
.
Applications are advised not to prompt the user about SSL errors, as the user is unlikely to be able to make an informed security decision and WebView does not provide any UI for showing the details of the error in a meaningful way.
Application overrides of this method may display custom error pages or silently log issues, but it is strongly recommended to always call SslErrorHandler#cancel
and never allow proceeding past errors.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.