After android 5.0, native webview loads HTML with https and http at the same time and does not load images solution

Transferred to: http://blog.csdn.net/u013806766/article/details/52095908

--------------------------------------------------------------------------------------------------

 

The company was hijacked by http before, and the web page opened by webview contained small advertisements, so the boss changed the request link to https, but our image server was still http. This change has no effect on versions below 5.0, but since 5.0 does not support mixed content by default, it does not support loading https and http mixed modes at the same time. So it goes like this:

if (Build.VERSION.SDK_INT >= 21) {
     webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}
  • 1
  • 2
  • 3

That's it.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326604643&siteId=291194637