這個幾率比較小, 但碰到還是比較蛋疼, 坑爹:
使用WebView加載一個https的URL, 而在在URL內(nèi)有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);
如此, 問題便解決了!!!