7

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.

Floern
  • 33,559
  • 24
  • 104
  • 119
CommonMan
  • 3,868
  • 2
  • 24
  • 35

1 Answers1

4

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.

Sergey Glotov
  • 20,200
  • 11
  • 84
  • 98