android x5 webview mixed content,Android WebView无法加载混合内容

Since Lollipop (API 21), WebView blocks all mixed content by default。

要更改此行为,当您定位API级别21或更高级别时,请使用:

webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);

In this mode, the WebView will attempt to be compatible with the

approach of a modern web browser with regard to mixed content. Some

insecure content may be allowed to be loaded by a secure origin and

other types of content will be blocked. The types of content are

allowed or blocked may change release to release and are not

explicitly defined.

在实践中,这应该允许加载图像,视频,音乐等 – 所有内容在被恶意第三方篡改/替换时具有主要安全威胁的可能性较低。

或者使用(强烈劝阻):

webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);

In this mode, the WebView will allow a secure origin to load content from any other origin, even if that origin is insecure. This is the least secure mode of operation for the WebView, and where possible apps should not set this mode.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值