I am creating application that use WebView to access a online website. I am stuck where I have to add code to check availability of page.
public class SpartanWeb
You can call loadErrorPage(view) function in the onReceivedError
function.
The following code will load the error content you need to show.Here i am load the html file with loadDataWithBaseURL
.
public void loadErrorPage(WebView webview){
if(webview!=null){
String htmlData =""This is the description for the load fail : "+description+"\nThe failed url is : "+failingUrl+"\n"";
webview.loadUrl("about:blank");
webview.loadDataWithBaseURL(null,htmlData, "text/html", "UTF-8",null);
webview.invalidate();
}
}