Android 6.0 以后webview不加载图片的问题


/**
* Webview在安卓5.0之前默认允许其加载混合网络协议内容
* 在安卓5.0之后,默认不允许加载http与https混合内容,需要设置webview允许其加载混合网络协议内容
*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
setting.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}

同时,在
WebViewClient


@Override
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
super.onReceivedHttpError(view, request, errorResponse);
CustomProgressDialogUtils.dismissProgressDialog();
LogUtils.d("出错了","22222");
//loadingFailed();
}

@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
// 注意:super句话一定要删除,或者注释掉,否则又走handler.cancel() 默认的不支持https的了。
// super.onReceivedSslError(view, handler, error);
handler.proceed();// 接受所有网站的证书
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM