The webpage that I’m trying to access is sending back a 403 error. I’s expecting WebViewClient to receive an error, but it doesn’t. Is it not supposed to get error?
engine.setWebViewClient(new WebViewClient() {
boolean error = false;
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
//IT DOESN'T COME HERE even IF SERVER SENDS BACK 403 ERROR
}
});
It seams like, I’ll have to read the response using HttpRequest and parse the response to check what’s going on. Is there any other way to do this? Can I check headers from within the WebView?
I had to implement the requirement using two requests. First request to check if credentials are ok and that there’s no error(using HttpURLConnection). Only if the response is OK do I load the webview.