java.lang.Object | |
↳ | android.webkit.WebViewClient |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ERROR_AUTHENTICATION | User authentication failed on server | |||||||||
int | ERROR_BAD_URL | Malformed URL | |||||||||
int | ERROR_CONNECT | Failed to connect to the server | |||||||||
int | ERROR_FAILED_SSL_HANDSHAKE | Failed to perform SSL handshake | |||||||||
int | ERROR_FILE | Generic file error | |||||||||
int | ERROR_FILE_NOT_FOUND | File not found | |||||||||
int | ERROR_HOST_LOOKUP | Server or proxy hostname lookup failed | |||||||||
int | ERROR_IO | Failed to read or write to the server | |||||||||
int | ERROR_PROXY_AUTHENTICATION | User authentication failed on proxy | |||||||||
int | ERROR_REDIRECT_LOOP | Too many redirects | |||||||||
int | ERROR_TIMEOUT | Connection timed out | |||||||||
int | ERROR_TOO_MANY_REQUESTS | Too many requests during this load | |||||||||
int | ERROR_UNKNOWN | Generic error | |||||||||
int | ERROR_UNSUPPORTED_AUTH_SCHEME | Unsupported authentication scheme (not basic or digest) | |||||||||
int | ERROR_UNSUPPORTED_SCHEME | Unsupported URI scheme |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Notify the host application to update its visited links database.
| |||||||||||
As the host application if the browser should resend data as the
requested page was a result of a POST.
| |||||||||||
Notify the host application that the WebView will load the resource
specified by the given url.
| |||||||||||
Notify the host application that a page has finished loading.
| |||||||||||
Notify the host application that a page has started loading.
| |||||||||||
Notify the host application to handle a SSL client certificate
request.
| |||||||||||
Report an error to the host application.
| |||||||||||
Notifies the host application that the WebView received an HTTP
authentication request.
| |||||||||||
Notify the host application that a request to automatically log in the
user has been processed.
| |||||||||||
Notify the host application that an SSL error occurred while loading a
resource.
| |||||||||||
Notify the host application that the scale applied to the WebView has
changed.
| |||||||||||
This method was deprecated
in API level 8.
This method is no longer called. When the WebView encounters
a redirect loop, it will cancel the load.
| |||||||||||
Notify the host application that a input event was not handled by the WebView.
| |||||||||||
This method is deprecated.
This method is subsumed by the more generic onUnhandledInputEvent.
| |||||||||||
Notify the host application of a resource request and allow the
application to return the data.
| |||||||||||
Give the host application a chance to handle the key event synchronously.
| |||||||||||
Give the host application a chance to take over the control when a new
url is about to be loaded in the current WebView.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
User authentication failed on server
Malformed URL
Failed to connect to the server
Failed to perform SSL handshake
Generic file error
File not found
Server or proxy hostname lookup failed
Failed to read or write to the server
User authentication failed on proxy
Too many redirects
Connection timed out
Too many requests during this load
Generic error
Unsupported authentication scheme (not basic or digest)
Unsupported URI scheme
Notify the host application to update its visited links database.
view | The WebView that is initiating the callback. |
---|---|
url | The url being visited. |
isReload | True if this url is being reloaded. |
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.
view | The WebView that is initiating the callback. |
---|---|
dontResend | The message to send if the browser should not resend |
resend | The message to send if the browser should resend data |
Notify the host application that the WebView will load the resource specified by the given url.
view | The WebView that is initiating the callback. |
---|---|
url | The url of the resource the WebView will load. |
Notify the host application that a page has finished loading. This method
is called only for main frame. When onPageFinished() is called, the
rendering picture may not be updated yet. To get the notification for the
new Picture, use onNewPicture(WebView, Picture)
.
view | The WebView that is initiating the callback. |
---|---|
url | The url of the page. |
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.
view | The WebView that is initiating the callback. |
---|---|
url | The url to be loaded. |
favicon | The favicon for this page if it already exists in the database. |
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: proceed(), cancel() or ignore(). Webview remembers the response if proceed() or cancel() is called and does not call onReceivedClientCertRequest() again for the same host and port pair. Webview does not remember the response if ignore() is called. This method is called on the UI thread. During the callback, the connection is suspended. The default behavior is to cancel, returning no client certificate.
view | The WebView that is initiating the callback |
---|---|
request | An instance of a ClientCertRequest
|
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.
view | The WebView that is initiating the callback. |
---|---|
errorCode | The error code corresponding to an ERROR_* value. |
description | A String describing the error. |
failingUrl | The url that failed to load. |
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.
view | the WebView that is initiating the callback |
---|---|
handler | the HttpAuthHandler used to set the WebView's response |
host | the host requiring authentication |
realm | the realm for which authentication is required |
Notify the host application that a request to automatically log in the user has been processed.
view | The WebView requesting the login. |
---|---|
realm | The account realm used to look up accounts. |
account | 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 | Authenticator specific arguments used to log in the user. |
Notify the host application that an SSL error occurred while loading a resource. The host application must call either handler.cancel() or handler.proceed(). Note that the decision may be retained for use in response to future SSL errors. The default behavior is to cancel the load.
view | The WebView that is initiating the callback. |
---|---|
handler | An SslErrorHandler object that will handle the user's response. |
error | The SSL error object. |
Notify the host application that the scale applied to the WebView has changed.
view | he WebView that is initiating the callback. |
---|---|
oldScale | The old scale factor |
newScale | The new scale factor |
This method was deprecated
in API level 8.
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.
view | The WebView that is initiating the callback. |
---|---|
cancelMsg | The message to send if the host wants to cancel |
continueMsg | The message to send if the host wants to continue |
Notify the host application that a input event was not handled by the WebView.
Except system keys, WebView always consumes input events in the normal flow
or if shouldOverrideKeyEvent returns true. This is called asynchronously
from where the event is dispatched. It gives the host application a chance
to handle the unhandled input events.
Note that if the event is a MotionEvent
, then it's lifetime is only
that of the function call. If the WebViewClient wishes to use the event beyond that, then it
must create a copy of the event.
It is the responsibility of overriders of this method to call
onUnhandledKeyEvent(WebView, KeyEvent)
when appropriate if they wish to continue receiving events through it.
view | The WebView that is initiating the callback. |
---|---|
event | The input event. |
This method is deprecated.
This method is subsumed by the more generic onUnhandledInputEvent.
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.
view | The WebView that is initiating the callback. |
---|---|
event | The key event. |
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. 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.
view | The WebView that is requesting the
resource. |
---|---|
url | The raw url of the resource. |
WebResourceResponse
containing the
response information or null if the WebView should load the
resource itself.
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.
view | The WebView that is initiating the callback. |
---|---|
event | The key event. |
Give the host application a chance to take over the control when a new url is about to be loaded in the current WebView. If WebViewClient is not provided, by default WebView will ask Activity Manager to choose the proper handler for the url. If WebViewClient is provided, return true means the host application handles the url, while return false means the current WebView handles the url. This method is not called for requests using the POST "method".
view | The WebView that is initiating the callback. |
---|---|
url | The url to be loaded. |