问题
Android WebView加载URL,最后显示白屏
原因
通过PC浏览器调试发现链接有Mixed Content警告,而Android Lollipop之后默认不允许Mixed content
解决
WebSettings setting = webView.getSettings();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
setting.setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
}
参考
https://stackoverflow.com/questions/32155634/android-webview-not-loading-mixed-content