WebView in my app is not loading an HTTPS URL
Try to add setJavascriptEnabled(true). And change the `
webb.setWebViewClient(new WebViewClient());
to this webView.setWebChromeClient(new WebChromeClient());
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView webb=(WebView)findViewById(R.id.web1);
webb.setWebViewClient(new WebViewClient());
webb.getSettings().setJavaScriptEnabled(true);
//webb.loadUrl("https://www.google.com/");
webb.loadUrl("https://192.168.2.29/ccc/");
}
}
Android WebView load https url results in blank screen
For the HttpsUrlConnection you are creating the certificate from a file and setting it at runtime.
The Webview must be using whatever is in the system already.
Here is a similar question with a workaround proposed:
Check in the onReceivedSslError() method of a WebViewClient if a certificate is signed from a specific self-signed CA
Webview not loading url in android
The webview is not working for particular url because the authorizer of that website have secured it in such a way. To Access that url in webview we need to get client certificate from the authority.
Android WebView not loading URL
Did you added the internet permission in your manifest file ? if not add the following line.
<uses-permission android:name="android.permission.INTERNET"/>
hope this will help you.
EDIT
Use the below lines.
public class WebViewDemo extends Activity {
private WebView webView;
Activity activity ;
private ProgressDialog progDailog;
@SuppressLint("NewApi")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
activity = this;
progDailog = ProgressDialog.show(activity, "Loading","Please wait...", true);
progDailog.setCancelable(false);
webView = (WebView) findViewById(R.id.webview_compontent);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.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();
}
});
webView.loadUrl("http://www.teluguoneradio.com/rssHostDescr.php?hostId=147");
}
}
WebView not loading certain pages
Use below code and it should work, I tested and it worked.
public class WebViewEx extends AppCompatActivity {
private WebView webView;
private ProgressDialog progDailog;
Activity activity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_view_ex);
webView = findViewById(R.id.webView);
activity = this;
progDailog = ProgressDialog.show(activity, "Loading", "Please wait...", true);
progDailog.setCancelable(false);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setDomStorageEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
webView.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();
}
});
webView.loadUrl("https://6awlanow.com/about/faqs");
}
}
Your XML will be like below:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
Below is the result I got in WebView:
I hope this will resolve your issue and let me know if you have any query.
Related Topics
Customize Android Facebook Login Button
Permission Is Only Granted to System App
Get All User Friends Using Facebook Graph API - Android
Export a Python Script to an Android Executable (.Apk) with Python-For-Android
Android - Multiple Screen Support Issue
Actionbaractivity Is Deprecated
How to Get String from Different Locales in Android
Android List View Drag and Drop Sort
Android: Creating Custom Preference
How to Use Web Camera in Android Emulator to Capture a Live Image
Android Device Not Shown with Adb
Differences Between Constraintlayout and Relativelayout
Restricting Usage for an Android Key for a Google API
Android Webview - Webpage Should Fit the Device Screen
How to Fix: "Hax Is Not Working and Emulator Runs in Emulation Mode"