这个几率比较小, 但碰到还是比较蛋疼, 坑爹:
使用WebView加载一个https的URL, 而在在URL内有http前缀的资源文件, 此时, 在Android 6.0 以上会导致资源文件加载失败...
报错如下:
"Mixed Content: The page at 'https://...' was loaded over HTTPS,
but requested an insecure image 'http://image.....jpg'.
This content should also be served over HTTPS."source: https://... (119)
这个错误是:
因为Android WebView 从Lollipop开始WebView默认不允许混合模式,https当中不能加载http资源,需要设置开启。
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
如此, 问题便解决了!!!
网友评论