WebViewClientCompat
open class WebViewClientCompat : WebViewClient, WebViewClientBoundaryInterface
kotlin.Any | ||
↳ | android.webkit.WebViewClient | |
↳ | androidx.webkit.WebViewClientCompat |
Compatibility version of android.webkit.WebViewClient
.
Summary
Public constructors | |
---|---|
<init>() Compatibility version of |
Public methods | |
---|---|
open Unit |
onPageCommitVisible(@NonNull view: WebView, @NonNull url: String) Notify the host application that |
Unit |
onReceivedError(@NonNull view: WebView, @NonNull request: WebResourceRequest, @NonNull error: WebResourceError) Applications are not meant to override this, and should instead override the non-final |
open Unit |
onReceivedError(@NonNull view: WebView, @NonNull request: WebResourceRequest, @NonNull error: WebResourceErrorCompat) Report web resource loading error to the host application. |
open Unit |
onReceivedHttpError(@NonNull view: WebView, @NonNull request: WebResourceRequest, @NonNull errorResponse: WebResourceResponse) Notify the host application that an HTTP error has been received from the server while loading a resource. |
Unit |
onSafeBrowsingHit(@NonNull view: WebView, @NonNull request: WebResourceRequest, threatType: Int, @NonNull response: SafeBrowsingResponse) Applications are not meant to override this, and should instead override the non-final |
open Unit |
onSafeBrowsingHit(@NonNull view: WebView, @NonNull request: WebResourceRequest, threatType: Int, @NonNull callback: SafeBrowsingResponseCompat) Notify the host application that a loading URL has been flagged by Safe Browsing. |
open Boolean |
shouldOverrideUrlLoading(@NonNull view: WebView, @NonNull request: WebResourceRequest) Give the host application a chance to take over the control when a new url is about to be loaded in the current WebView. |
Public constructors
Public methods
onPageCommitVisible
@UiThread open fun onPageCommitVisible(
@NonNull view: WebView,
@NonNull 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
.
Please note that all the conditions and recommendations applicable to WebViewCompat#postVisualStateCallback
also apply to this API.
This callback is only called for main frame navigations.
This method is called only if WebViewFeature#VISUAL_STATE_CALLBACK
is supported. You can check whether that flag is supported using
.
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. |
onReceivedError
@RequiresApi(23