Added in API level 1

WebViewClient


open class WebViewClient
kotlin.Any
   ↳ android.webkit.WebViewClient

Summary

Constants
static Int

User authentication failed on server

static Int

Malformed URL

static Int

Failed to connect to the server

static Int

Failed to perform SSL handshake

static Int

Generic file error

static Int

File not found

static Int

Server or proxy hostname lookup failed

static Int

Failed to read or write to the server

static Int

User authentication failed on proxy

static Int

Too many redirects

static Int

Connection timed out

static Int

Too many requests during this load

static Int

Generic error

static Int

Resource load was canceled by Safe Browsing

static Int

Unsupported authentication scheme (not basic or digest)

static Int

Unsupported URI scheme

static Int

The resource was blocked because it may trick the user into a billing agreement.

static Int

The resource was blocked because it contains malware.

static Int

The resource was blocked because it contains deceptive content.

static Int

The resource was blocked for an unknown reason.

static Int

The resource was blocked because it contains unwanted software.

Public constructors

Public methods
open Unit
doUpdateVisitedHistory(view: WebView!, url: String!, isReload: Boolean)

Notify the host application to update its visited links database.

open Unit
onFormResubmission(view: WebView!, dontResend: Message!, resend: Message!)

As the host application if the browser should resend data as the requested page was a result of a POST.

open Unit
onLoadResource(view: WebView!, url: String!)

Notify the host application that the WebView will load the resource specified by the given url.

open Unit

Notify the host application that android.webkit.WebView content left over from previous page navigations will no longer be drawn.

open Unit
onPageFinished(view: WebView!, url: String!)

Notify the host application that a page has finished loading.

open Unit
onPageStarted(view: WebView!, url: String!, favicon: Bitmap!)

Notify the host application that a page has started loading.

open Unit

Notify the host application to handle a SSL client certificate request.

open Unit
onReceivedError(view: WebView!, errorCode: Int, description: String!, failingUrl: String!)

Report an error to the host application.

open Unit

Report web resource loading error to the host application.

open Unit
onReceivedHttpAuthRequest(view: WebView!, handler: HttpAuthHandler!, host: String!, realm: String!)

Notifies the host application that the WebView received an HTTP authentication request.

open Unit
onReceivedHttpError(view: WebView!, request: WebResourceRequest!, errorResponse: WebResourceResponse!)

Notify the host application that an HTTP error has been received from the server while loading a resource.

open Unit
onReceivedLoginRequest(view: WebView!, realm: String!, account: String?, args: String!)

Notify the host application that a request to automatically log in the user has been processed.

open Unit
onReceivedSslError(view: WebView!, handler: SslErrorHandler!, error: SslError!)

Notifies the host application that an SSL error occurred while loading a resource.

open Boolean

Notify host application that the given WebView's render process has exited.

open Unit
onSafeBrowsingHit(view: WebView!, request: WebResourceRequest!, threatType: Int, callback: SafeBrowsingResponse!)

Notify the host application that a loading URL has been flagged by Safe Browsing.

open Unit
onScaleChanged(view: WebView!, oldScale: Float, newScale: Float)

Notify the host application that the scale applied to the WebView has changed.

open Unit
onTooManyRedirects(view: WebView!, cancelMsg: Message!, continueMsg: Message!)

Notify the host application that there have been an excessive number of HTTP redirects.

open Unit

Notify the host application that a key was not handled by the WebView.

open WebResourceResponse?

Notify the host application of a resource request and allow the application to return the data.

open WebResourceResponse?

Notify the host application of a resource request and allow the application to return the data.

open Boolean

Give the host application a chance to handle the key event synchronously.

open Boolean

Give the host application a chance to take control when a URL is about to be loaded in the current WebView.

open Boolean

Give the host application a chance to take control when a URL is about to be loaded in the current WebView.

Constants

ERROR_AUTHENTICATION

Added in API level 5
static val ERROR_AUTHENTICATION: Int

User authentication failed on server

Value: -4

ERROR_BAD_URL

Added in API level 5
static val ERROR_BAD_URL: Int

Malformed URL

Value: -12

ERROR_CONNECT

Added in API level 5
static val ERROR_CONNECT: Int

Failed to connect to the server

Value: -6

ERROR_FAILED_SSL_HANDSHAKE

Added in API level 5
static val ERROR_FAILED_SSL_HANDSHAKE: Int

Failed to perform SSL handshake

Value: -11

ERROR_FILE

Added in API level 5
static val ERROR_FILE: Int

Generic file error

Value: -13

ERROR_FILE_NOT_FOUND

Added in API level 5
static val ERROR_FILE_NOT_FOUND: Int

File not found

Value: -14

ERROR_HOST_LOOKUP

Added in API level 5
static val ERROR_HOST_LOOKUP: Int

Server or proxy hostname lookup failed

Value: -2

ERROR_IO

Added in API level 5
static val ERROR_IO: Int

Failed to read or write to the server

Value: -7

ERROR_PROXY_AUTHENTICATION

Added in API level 5
static val ERROR_PROXY_AUTHENTICATION: Int

User authentication failed on proxy

Value: -5

ERROR_REDIRECT_LOOP

Added in API level 5
static val ERROR_REDIRECT_LOOP: Int

Too many redirects

Value: -9

ERROR_TIMEOUT

Added in API level 5
static val ERROR_TIMEOUT: Int

Connection timed out

Value: -8

ERROR_TOO_MANY_REQUESTS

Added in API level 5
static val ERROR_TOO_MANY_REQUESTS: Int

Too many requests during this load

Value: -15

ERROR_UNKNOWN

Added in API level 5
static val ERROR_UNKNOWN: Int

Generic error

Value: -1

ERROR_UNSAFE_RESOURCE

Added in API level 26
static val ERROR_UNSAFE_RESOURCE: Int

Resource load was canceled by Safe Browsing

Value: -16

ERROR_UNSUPPORTED_AUTH_SCHEME

Added in API level 5
static val ERROR_UNSUPPORTED_AUTH_SCHEME: Int

Unsupported authentication scheme (not basic or digest)

Value: -3

ERROR_UNSUPPORTED_SCHEME

Added in API level 5
static val ERROR_UNSUPPORTED_SCHEME: Int

Unsupported URI scheme

Value: -10

SAFE_BROWSING_THREAT_BILLING

Added in API level 29
static val SAFE_BROWSING_THREAT_BILLING: Int

The resource was blocked because it may trick the user into a billing agreement.

This constant is only used when targetSdkVersion is at least android.os.Build.VERSION_CODES#Q. Otherwise, SAFE_BROWSING_THREAT_UNKNOWN is used instead.

Value: 4

SAFE_BROWSING_THREAT_MALWARE

Added in API level 27
static val SAFE_BROWSING_THREAT_MALWARE: Int

The resource was blocked because it contains malware.

Value: 1

SAFE_BROWSING_THREAT_PHISHING

Added in API level 27
static val SAFE_BROWSING_THREAT_PHISHING: Int

The resource was blocked because it contains deceptive content.

Value: 2

SAFE_BROWSING_THREAT_UNKNOWN

Added in API level 27
static val SAFE_BROWSING_THREAT_UNKNOWN: Int

The resource was blocked for an unknown reason.

Value: 0

SAFE_BROWSING_THREAT_UNWANTED_SOFTWARE

Added in API level 27
static val SAFE_BROWSING_THREAT_UNWANTED_SOFTWARE: Int

The resource was blocked because it contains unwanted software.

Value: 3

Public constructors

WebViewClient

WebViewClient()

Public methods

doUpdateVisitedHistory

Added in API level 1
open fun doUpdateVisitedHistory(
    view: WebView!,
    url: String!,
    isReload: Boolean
): Unit

Notify the host application to update its visited links database.

Parameters
view WebView!: The WebView that is initiating the callback.
url String!: The url being visited.
isReload Boolean: true if this url is being reloaded.

onFormResubmission

Added in API level 1
open fun onFormResubmission(
    view: WebView!,
    dontResend: Message!,
    resend: Message!
): Unit

As the host application if the browser should resend data as the requested page was a result of a POST. The default is to not resend the data.

Parameters
view WebView!: The WebView that is initiating the callback.
dontResend Message!: The message to send if the browser should not resend
resend Message!: The message to send if the browser should resend data

onLoadResource

Added in API level 1
open fun onLoadResource(
    view: WebView!,
    url: String!
): Unit

Notify the host application that the WebView will load the resource specified by the given url.

Parameters
view WebView!: The WebView that is initiating the callback.
url String!: The url of the resource the WebView will load.

onPageCommitVisible

Added in API level 23
open fun onPageCommitVisible(
    view: WebView!,
    url: String!
): Unit

Notify the host application that android.webkit.WebView content left over from previous page navigations will no longer be drawn.

This callback can be used to determine the point at which it is safe to make a recycled android.webkit.WebView visible, ensuring that no stale content is shown. It is called at the earliest point at which it can be guaranteed that WebView#onDraw will no longer draw any content from previous navigations. The next draw will display either the background color of the WebView, or some of the contents of the newly loaded page.

This method is called when the body of the HTTP response has started loading, is reflected in the DOM, and will be visible in subsequent draws. This callback occurs early in the document loading process, and as such you should expect that linked resources (for example, CSS and images) may not be available.

For more fine-grained notification of visual state updates, see android.webkit.WebView#postVisualStateCallback.

Please note that all the conditions and recommendations applicable to WebView#postVisualStateCallback also apply to this API.

This callback is only called for main frame navigations.

Parameters
view WebView!: The android.webkit.WebView for which the navigation occurred.
url String!: The URL corresponding to the page navigation that triggered this callback.

onPageFinished

Added in API level 1
open fun onPageFinished(
    view: WebView!,
    url: String!
): Unit

Notify the host application that a page has finished loading. This method is called only for main frame. Receiving an onPageFinished() callback does not guarantee that the next frame drawn by WebView will reflect the state of the DOM at this point. In order to be notified that the current DOM state is ready to be rendered, request a visual state callback with WebView#postVisualStateCallback and wait for the supplied callback to be triggered.

Parameters
view WebView!: The WebView that is initiating the callback.
url String!: The url of the page.

onPageStarted

Added in API level 1
open fun onPageStarted(
    view: WebView!,
    url: String!,
    favicon: Bitmap!
): Unit

Notify the host application that a page has started loading. This method is called once for each main frame load so a page with iframes or framesets will call onPageStarted one time for the main frame. This also means that onPageStarted will not be called when the contents of an embedded frame changes, i.e. clicking a link whose target is an iframe, it will also not be called for fragment navigations (navigations to #fragment_id).

Parameters
view WebView!: The WebView that is initiating the callback.
url String!: The url to be loaded.
favicon Bitmap!: The favicon for this page if it already exists in the database.

onReceivedClientCertRequest

Added in API level 21
open fun onReceivedClientCertRequest(
    view: WebView!,
    request: ClientCertRequest!
): Unit

Notify the host application to handle a SSL client certificate request. The host application is responsible for showing the UI if desired and providing the keys. There are three ways to respond: ClientCertRequest#proceed, ClientCertRequest#cancel, or android.webkit.ClientCertRequest#ignore. Webview stores the response in memory (for the life of the application) if ClientCertRequest#proceed or ClientCertRequest#cancel is called and does not call onReceivedClientCertRequest() again for the same host and port pair. Webview does not store the response if ClientCertRequest#ignore is called. Note that, multiple layers in chromium network stack might be caching the responses, so the behavior for ignore is only a best case effort. This method is called on the UI thread. During the callback, the connection is suspended. For most use cases, the application program should implement the android.security.KeyChainAliasCallback interface and pass it to android.security.KeyChain#choosePrivateKeyAlias to start an activity for the user to choose the proper alias. The keychain activity will provide the alias through the callback method in the implemented interface. Next the application should create an async task to call android.security.KeyChain#getPrivateKey to receive the key. An example implementation of client certificates can be seen at AOSP Browser The default behavior is to cancel, returning no client certificate.

Parameters
view WebView!: The WebView that is initiating the callback
request ClientCertRequest!: An instance of a ClientCertRequest

onReceivedError

Added in API level 1
Deprecated in API level 23
open fun onReceivedError(
    view: WebView!,
    errorCode: Int,
    description: String!,
    failingUrl: String!
): Unit

Deprecated: Use onReceivedError(WebView, WebResourceRequest, WebResourceError) instead.

Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable). The errorCode parameter corresponds to one of the ERROR_* constants.

Parameters
view WebView!: The WebView that is initiating the callback.
errorCode Int: The error code corresponding to an ERROR_* value.
description String!: A String describing the error.
failingUrl String!: The url that failed to load.

onReceivedError

Added in API level 23
open fun onReceivedError(
    view: WebView!,
    request: WebResourceRequest!,
    error: WebResourceError!
): Unit

Report web resource loading error to the host application. These errors usually indicate inability to connect to the server. Note that unlike the deprecated version of the callback, the new version will be called for any resource (iframe, image, etc.), not just for the main page. Thus, it is recommended to perform minimum required work in this callback.

Parameters
view WebView!: The WebView that is initiating the callback.
request WebResourceRequest!: The originating request.
error WebResourceError!: Information about the error occurred.

onReceivedHttpAuthRequest

Added in API level 1
open fun onReceivedHttpAuthRequest(
    view: WebView!,
    handler: HttpAuthHandler!,
    host: String!,
    realm: String!
): Unit

Notifies the host application that the WebView received an HTTP authentication request. The host application can use the supplied HttpAuthHandler to set the WebView's response to the request. The default behavior is to cancel the request.

Note: The supplied HttpAuthHandler must be used on the UI thread.

Parameters
view WebView!: the WebView that is initiating the callback
handler HttpAuthHandler!: the HttpAuthHandler used to set the WebView's response
host String!: the host requiring authentication
realm String!: the realm for which authentication is required

onReceivedHttpError

Added in API level 23
open fun onReceivedHttpError(
    view: WebView!,
    request: WebResourceRequest!,
    errorResponse: WebResourceResponse!
): Unit

Notify the host application that an HTTP error has been received from the server while loading a resource. HTTP errors have status codes >= 400. This callback will be called for any resource (iframe, image, etc.), not just for the main page. Thus, it is recommended to perform minimum required work in this callback. Note that the content of the server response may not be provided within the errorResponse parameter.

Parameters
view WebView!: The WebView that is initiating the callback.
request WebResourceRequest!: The originating request.
errorResponse WebResourceResponse!: Information about the error occurred.

onReceivedLoginRequest

Added in API level 12
open fun onReceivedLoginRequest(
    view: WebView!,
    realm: String!,
    account: String?,
    args: String!
): Unit

Notify the host application that a request to automatically log in the user has been processed.

Parameters
view WebView!: The WebView requesting the login.
realm String!: The account realm used to look up accounts.
account String?: An optional account. If not null, the account should be checked against accounts on the device. If it is a valid account, it should be used to log in the user.
args String!: Authenticator specific arguments used to log in the user.

onReceivedSslError

Added in API level 8
open fun onReceivedSslError(
    view: WebView!,
    handler: SslErrorHandler!,
    error: SslError!
): Unit

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

Warning: 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.

Note: 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, with the ERROR_FAILED_SSL_HANDSHAKE argument.

Parameters
view WebView!: WebView that initiated the callback.
handler SslErrorHandler!: SslErrorHandler that handles the user's response.
error SslError!: SSL error object.

onRenderProcessGone

Added in API level 26
open fun onRenderProcessGone(
    view: WebView!,
    detail: RenderProcessGoneDetail!
): Boolean

Notify host application that the given WebView's render process has exited. Multiple WebView instances may be associated with a single render process; onRenderProcessGone will be called for each WebView that was affected. The application's implementation of this callback should only attempt to clean up the specific WebView given as a parameter, and should not assume that other WebView instances are affected. The given WebView can't be used, and should be removed from the view hierarchy, all references to it should be cleaned up, e.g any references in the Activity or other classes saved using android.view.View#findViewById and similar calls, etc. To cause an render process crash for test purpose, the application can call loadUrl("chrome://crash") on the WebView. Note that multiple WebView instances may be affected if they share a render process, not just the specific WebView which loaded chrome://crash.

Parameters
view WebView!: The WebView which needs to be cleaned up.
detail RenderProcessGoneDetail!: the reason why it exited.
Return
Boolean true if the host application handled the situation that process has exited, otherwise, application will crash if render process crashed, or be killed if render process was killed by the system.

onSafeBrowsingHit

Added in API level 27
open fun onSafeBrowsingHit(
    view: WebView!,
    request: WebResourceRequest!,
    threatType: Int,
    callback: SafeBrowsingResponse!
): Unit

Notify the host application that a loading URL has been flagged by Safe Browsing. The application must invoke the callback to indicate the preferred response. The default behavior is to show an interstitial to the user, with the reporting checkbox visible. If the application needs to show its own custom interstitial UI, the callback can be invoked asynchronously with SafeBrowsingResponse#backToSafety or android.webkit.SafeBrowsingResponse#proceed, depending on user response.

Parameters
view WebView!: The WebView that hit the malicious resource.
request WebResourceRequest!: Object containing the details of the request.
threatType Int: The reason the resource was caught by Safe Browsing, corresponding to a SAFE_BROWSING_THREAT_* value. Value is android.webkit.WebViewClient#SAFE_BROWSING_THREAT_UNKNOWN, android.webkit.WebViewClient#SAFE_BROWSING_THREAT_MALWARE, android.webkit.WebViewClient#SAFE_BROWSING_THREAT_PHISHING, android.webkit.WebViewClient#SAFE_BROWSING_THREAT_UNWANTED_SOFTWARE, or android.webkit.WebViewClient#SAFE_BROWSING_THREAT_BILLING
callback SafeBrowsingResponse!: Applications must invoke one of the callback methods.

onScaleChanged

Added in API level 1
open fun onScaleChanged(
    view: WebView!,
    oldScale: Float,
    newScale: Float
): Unit

Notify the host application that the scale applied to the WebView has changed.

Parameters
view WebView!: The WebView that is initiating the callback.
oldScale Float: The old scale factor
newScale Float: The new scale factor

onTooManyRedirects

Added in API level 1
Deprecated in API level 15
open fun onTooManyRedirects(
    view: WebView!,
    cancelMsg: Message!,
    continueMsg: Message!
): Unit

Deprecated: This method is no longer called. When the WebView encounters a redirect loop, it will cancel the load.

Notify the host application that there have been an excessive number of HTTP redirects. As the host application if it would like to continue trying to load the resource. The default behavior is to send the cancel message.

Parameters
view WebView!: The WebView that is initiating the callback.
cancelMsg Message!: The message to send if the host wants to cancel
continueMsg Message!: The message to send if the host wants to continue

onUnhandledKeyEvent

Added in API level 1
open fun onUnhandledKeyEvent(
    view: WebView!,
    event: KeyEvent!
): Unit

Notify the host application that a key was not handled by the WebView. Except system keys, WebView always consumes the keys in the normal flow or if shouldOverrideKeyEvent returns true. This is called asynchronously from where the key is dispatched. It gives the host application a chance to handle the unhandled key events.

Parameters
view WebView!: The WebView that is initiating the callback.
event KeyEvent!: The key event.

shouldInterceptRequest

Added in API level 11
Deprecated in API level 21
open fun shouldInterceptRequest(
    view: WebView!,
    url: String!
): WebResourceResponse?

Deprecated: Use shouldInterceptRequest(WebView, WebResourceRequest) instead.

Notify the host application of a resource request and allow the application to return the data. If the return value is null, the WebView will continue to load the resource as usual. Otherwise, the return response and data will be used.

This callback is invoked for a variety of URL schemes (e.g., http(s):, data:, file:, etc.), not only those schemes which send requests over the network. This is not called for javascript: URLs, blob: URLs, or for assets accessed via file:///android_asset/ or file:///android_res/ URLs.

In the case of redirects, this is only called for the initial resource URL, not any subsequent redirect URLs.

Note: This method is called on a thread other than the UI thread so clients should exercise caution when accessing private data or the view system.

Note: When Safe Browsing is enabled, these URLs still undergo Safe Browsing checks. If this is undesired, you can use WebView#setSafeBrowsingWhitelist to skip Safe Browsing checks for that host or dismiss the warning in onSafeBrowsingHit by calling SafeBrowsingResponse#proceed.

Parameters
view WebView!: The android.webkit.WebView that is requesting the resource.
url String!: The raw url of the resource.
Return
WebResourceResponse? A android.webkit.WebResourceResponse containing the response information or null if the WebView should load the resource itself.

shouldInterceptRequest

Added in API level 21
open fun shouldInterceptRequest(
    view: WebView!,
    request: WebResourceRequest!
): WebResourceResponse?

Notify the host application of a resource request and allow the application to return the data. If the return value is null, the WebView will continue to load the resource as usual. Otherwise, the return response and data will be used.

This callback is invoked for a variety of URL schemes (e.g., http(s):, data:, file:, etc.), not only those schemes which send requests over the network. This is not called for javascript: URLs, blob: URLs, or for assets accessed via file:///android_asset/ or file:///android_res/ URLs.

In the case of redirects, this is only called for the initial resource URL, not any subsequent redirect URLs.

Note: This method is called on a thread other than the UI thread so clients should exercise caution when accessing private data or the view system.

Note: When Safe Browsing is enabled, these URLs still undergo Safe Browsing checks. If this is undesired, you can use WebView#setSafeBrowsingWhitelist to skip Safe Browsing checks for that host or dismiss the warning in onSafeBrowsingHit by calling SafeBrowsingResponse#proceed.

Parameters
view WebView!: The android.webkit.WebView that is requesting the resource.
request WebResourceRequest!: Object containing the details of the request.
Return
WebResourceResponse? A android.webkit.WebResourceResponse containing the response information or null if the WebView should load the resource itself.

shouldOverrideKeyEvent

Added in API level 1
open fun shouldOverrideKeyEvent(
    view: WebView!,
    event: KeyEvent!
): Boolean

Give the host application a chance to handle the key event synchronously. e.g. menu shortcut key events need to be filtered this way. If return true, WebView will not handle the key event. If return false, WebView will always handle the key event, so none of the super in the view chain will see the key event. The default behavior returns false.

Parameters
view WebView!: The WebView that is initiating the callback.
event KeyEvent!: The key event.
Return
Boolean true if the host application wants to handle the key event itself, otherwise return false

shouldOverrideUrlLoading

Added in API level 1
Deprecated in API level 24
open fun shouldOverrideUrlLoading(
    view: WebView!,
    url: String!
): Boolean

Deprecated: Use shouldOverrideUrlLoading(WebView, WebResourceRequest) instead.

Give the host application a chance to take control when a URL is about to be loaded in the current WebView. If a WebViewClient is not provided, by default WebView will ask Activity Manager to choose the proper handler for the URL. If a WebViewClient is provided, returning true causes the current WebView to abort loading the URL, while returning false causes the WebView to continue loading the URL as usual.

Note: Do not call WebView#loadUrl(String) with the same URL and then return true. This unnecessarily cancels the current load and starts a new load with the same URL. The correct way to continue loading a given URL is to simply return false, without calling WebView#loadUrl(String).

Note: This method is not called for POST requests.

Note: This method may be called for subframes and with non-HTTP(S) schemes; calling WebView#loadUrl(String) with such a URL will fail.

Parameters
view WebView!: The WebView that is initiating the callback.
url String!: The URL to be loaded.
Return
Boolean true to cancel the current load, otherwise return false.

shouldOverrideUrlLoading

Added in API level 24
open fun shouldOverrideUrlLoading(
    view: WebView!,
    request: WebResourceRequest!
): Boolean

Give the host application a chance to take control when a URL is about to be loaded in the current WebView. If a WebViewClient is not provided, by default WebView will ask Activity Manager to choose the proper handler for the URL. If a WebViewClient is provided, returning true causes the current WebView to abort loading the URL, while returning false causes the WebView to continue loading the URL as usual.

This callback is not called for all page navigations. In particular, this is not called for navigations which the app initiated with loadUrl(): this callback would not serve a purpose in this case, because the app already knows about the navigation. This callback lets the app know about navigations initiated by the web page (such as navigations initiated by JavaScript code), by the user (such as when the user taps on a link), or by an HTTP redirect (ex. if loadUrl("foo.com") redirects to "bar.com" because of HTTP 301).

Note: Do not call WebView#loadUrl(String) with the request's URL and then return true. This unnecessarily cancels the current load and starts a new load with the same URL. The correct way to continue loading a given URL is to simply return false, without calling WebView#loadUrl(String).

Note: This method is not called for POST requests.

Note: This method may be called for subframes and with non-HTTP(S) schemes; calling WebView#loadUrl(String) with such a URL will fail.

Parameters
view WebView!: The WebView that is initiating the callback.
request WebResourceRequest!: Object containing the details of the request.
Return
Boolean true to cancel the current load, otherwise return false.