I'm setting up a url https://turnbackhoax.id/
inside a WebView
. But the WebView
is just showing a blank page. I have tried to set other URLs and those work. I've learned and searched for a similar problem but nothing changed.
Following is my WebView
code:
public class LaporPage extends AppCompatActivity {
private WebView webV;
Activity activity;
private ProgressDialog progDailog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lapor_page);
activity = this;
progDailog = ProgressDialog.show(activity, "Loading","Please wait...", true);
progDailog.setCancelable(false);
webV = (WebView) findViewById(R.id.web_view);
webV.getSettings().setDomStorageEnabled(true);
webV.getSettings().setJavaScriptEnabled(true);
webV.getSettings().setLoadWithOverviewMode(true);
webV.getSettings().setUseWideViewPort(true);
webV.setWebChromeClient(new WebChromeClient());
webV.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
progDailog.show();
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, final String url) {
progDailog.dismiss();
}
});
webV.loadUrl("https://turnbackhoax.id/");
}
}
I have checked the URL, it is throwing an SSL handshake error in the web view. Although it's not a good practice to ignore the SSL error but this will solve your problem
webview.setWebViewClient(new WebViewClient(){
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler,SslError error) {
handler.proceed();
}
});