https无法打开处理
This commit is contained in:
parent
361ad6111c
commit
9db4b16e24
@ -5,9 +5,12 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.net.http.SslError;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.SslErrorHandler;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
@ -81,6 +84,11 @@ public class WebActivity extends BaseActivity {
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webSettings.setDefaultTextEncodingName("utf-8");
|
||||
// 特别注意:5.1以上默认禁止了https和http混用,以下方式是开启
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
}
|
||||
|
||||
wv.addJavascriptInterface(new JavaScriptObject(con), "webObj");
|
||||
//PaxWebChromeClient chromeClient=new PaxWebChromeClient();
|
||||
//WebView加载web资源
|
||||
@ -111,6 +119,12 @@ public class WebActivity extends BaseActivity {
|
||||
wv.loadUrl(url);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
||||
super.onReceivedSslError(view, handler, error);
|
||||
handler.proceed();
|
||||
}
|
||||
});
|
||||
wv.setWebChromeClient(chromeClient);
|
||||
wv.loadUrl(url);
|
||||
@ -149,6 +163,12 @@ public class WebActivity extends BaseActivity {
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
||||
super.onReceivedSslError(view, handler, error);
|
||||
handler.proceed();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user