Partager via


WebViewClient.OnReceivedSslError(WebView, SslErrorHandler, SslError) Method

Definition

Notifies 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

WebView that initiated the callback.

handler
SslErrorHandler

SslErrorHandler that handles the user's response.

error
SslError

SSL error object.

Attributes

Remarks

Notifies the host application that an SSL error occurred while loading a resource. The host application must call either SslErrorHandler#cancel() or SslErrorHandler#proceed().

<b>Warning:</b> Application overrides of this method can be used to display custom error pages or to silently log issues, but the host application should always call SslErrorHandler#cancel() and never proceed past errors.

<b>Note:</b> Do not prompt the user about SSL errors. Users are unlikely to be able to make an informed security decision, and WebView does not provide a UI for showing the details of the error in a meaningful way.

The decision to call proceed() or cancel() may be retained to facilitate responses to future SSL errors. The default behavior is to cancel the resource loading process.

This API is called only for recoverable SSL certificate errors. For non-recoverable errors (such as when the server fails the client), the WebView calls #onReceivedError(WebView, WebResourceRequest, WebResourceError) onReceivedError(WebView, WebResourceRequest, WebResourceError) with the #ERROR_FAILED_SSL_HANDSHAKE argument.

Java documentation for android.webkit.WebViewClient.onReceivedSslError(android.webkit.WebView, android.webkit.SslErrorHandler, android.net.http.SslError).

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.

Applies to