R
R
Roman Govorov2018-08-23 20:12:09
Android
Roman Govorov, 2018-08-23 20:12:09

WebView does not display a site without an SSL certificate, i.e. http pages what to do?

package com.site.dasdadsd.dadadsad;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.webkit.WebSettings;
import android.webkit.WebView;

public class MainActivity extends AppCompatActivity {

    private WebView webView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        webView = (WebView) findViewById(R.id.webView);

        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);

        SimpleWebViewClientImpl webViewClient = new SimpleWebViewClientImpl(this);
        webView.setWebViewClient(webViewClient);

        webView.loadUrl("https://kontur-extern.net/");
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if ((keyCode == KeyEvent.KEYCODE_BACK) && this.webView.canGoBack()) {
            this.webView.goBack();
            return true;
        }

        return super.onKeyDown(keyCode, event);
    }
}

5b7eead093d11953145553.png5b7eead66b010560398941.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2018-08-24
@RGameShow

Solution to your problem -
https://stackoverflow.com/questions/45940861/andro...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question