Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference b/w onReceivedHttpError and onReceivedError for WebView Client

I am trying to understand the difference b/w https://developer.android.com/reference/android/webkit/WebViewClient.html

onRecievedHttpError and onRecievedError.

For me I always get both of these callbacks for all errors in my webpage? Why we have two callbacks then.

like image 315
CommonMan Avatar asked Aug 18 '16 21:08

CommonMan


1 Answers

onReceivedError()

Report web resource loading error to the host application. These errors usually indicate inability to connect to the server.

It's about network/server errors. The errors are not HTTP errors but are unrecoverable resource errors (file not found, no network connection, server not found for the main resource, etc.). If there is a network error, there cannot be a HTTP error code transmitted.

onReceivedHttpError()

Notify the host application that an HTTP error has been received from the server while loading a resource. HTTP errors have status codes >= 400.

like image 124
Sergey Glotov Avatar answered Nov 15 '22 04:11

Sergey Glotov