Reputation: 128448
I am trying to load URL inside a WebViewClient as below:
webview.setWebViewClient(new WebViewClient()
{
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
public void onPageFinished(WebView view, String url)
{
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
{
}
});
webview.loadUrl(articleLink);
Web URL is loading successfully but in some occurrence i got the following errors, at the same time i would like to display Alert Dialog instead of Webview with Error message.
So can you please let me know ,How do i handle the following kind of errors:
I have attached the 2nd one's image for your reference:
Upvotes: 0
Views: 1906
Reputation: 1218
Both of those are server side errors. 1. is the page is either physically not there (404) or a 2. the server is serving you a page that states it will not show you the directory (200)
but you should be able to handle them inside the OnReceivedError() you can create a dialog box from there.
Upvotes: 3