Android Question [ DefaultWebChromeClient ] how can i get page ErrorCode using ChromeClient ?

drgottjr

Expert
Licensed User
Longtime User
you don't say which type of error you are referring to.
as far as chromeclient is concerned, it doesn't report errors; webviewclient does. chromeclient reports console messages (which, possibly, may contain some types of error messages).

there is no actual "default" webchromeclient, but i'm guessing you're referring to the webviewextras library v2 where the term is mentioned.
in that library, you can set up a webviewclient. it will trap for a couple different types of webview errors (i'm not sure if it traps for all. i haven't looked at the library in a while.) in any case, webviewclient will raise an event in your app; you just need to create that sub to handle the messages. but again, it's not clear which kinds of errors you're talking about. google's documentation regarding webviewclient is helpful.

if you're ready for the next level, you can cobble together a custom webviewclient from various postings here with inline java. not the most difficult first project, and there are posts relating to it, mainly thanks to erel - master of teach by example. are you ready?:)
 
Upvote 0

Waldemar Lima

Well-Known Member
Licensed User
my problem is this: i'm creating a webapp that loads content from a url on the web ...
I would like to catch errors like: 404, 500, or errors that can prevent Webview from loading the content and displaying something that the client shouldn't see ...
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
geolocation isn't an error. you said you wanted something for errors. now you want something else, something for geolocation. no problem; you need webview client (for errors and for preventing the client from seeing things) and webchromeclient (for the geolocation prompt).
 
Upvote 0
Top