Webview not able to load https url in android?

Hareesh picture Hareesh · Aug 22, 2013 · Viewed 29.6k times · Source

I am implementing webview application in android. When i am trying to load https url one or two times it finishes the activity. Agian trying to load https url it shows webpage not available. please find below image what i got.

enter image description here

When i click on that url again, then it shows the websit.

I used the below code for loading the url.

webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true); 
webView.loadUrl("https://www.facebook.com");
webView.clearView();
webView.measure(100, 100);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setLoadWithOverviewMode(true);



    webView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }

        @SuppressLint("NewApi")
        @Override
        public void onReceivedSslError(WebView view, SslErrorHandler handler,     SslError error) {
            super.onReceivedSslError(view, handler, error);

            // this will ignore the Ssl error and will go forward to your site
            handler.proceed();
            error.getCertificate();
        }
    });

please any help guys.......

Thanks in advance

Answer

KOTIOS picture KOTIOS · Feb 23, 2015

Try to use below attributes :

        webView = (WebView) findViewById(R.id.webView1);
        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setDomStorageEnabled(true);