【问题标题】:Android Webview fail load mixed pageAndroid Webview 加载混合页面失败
【发布时间】:2016-04-20 13:13:51
【问题描述】:

在我的 android 应用程序中,我使用 webview 来加载 https url。页面包含混合内容(安全和不安全)。我收到带有 net::ERR_CONNECTION_TIMED_OUT 声明的onReceivedError()。当我尝试在 chrome 中通过此 url 连接到服务器时,建立连接需要很长时间(大约 5 分钟)但成功了。

我该如何解决这个问题? 要么 如何增加 WebView 的连接时间? function setMixedContentMode( WebSettings.MIXED_CONTENT_ALWAYS_ALLOW )我试过了。

【问题讨论】:

    标签: android webview


    【解决方案1】:
     WebView wv = (WebView) findViewById(R.id.webView);
     wv.setWebViewClient(new WebViewClient() {
    
     @Override
     public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
    
            super.onReceivedError(view, errorCode, description, failingUrl);
            // do your stuff here
           }
    });
    

    【讨论】:

    • @Override public void onReceivedSslError(WebView view, android.webkit.SslErrorHandler handler, android.net.http.SslError error) { handler.proceed(); };
    • Prashant Mishra 你是什么意思?我知道这种方法并使用它。不调用 onReceivedSslError() 回调
    猜你喜欢
    • 2015-11-16
    • 1970-01-01
    • 2018-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-16
    • 2015-02-25
    相关资源
    最近更新 更多