Android WebView blocks redirect from https to http
来源:互联网 发布:虎牙软件下载 编辑:程序博客网 时间:2024/05/18 00:06
最近遇到一个问题,在webview里面加载https url的时候,如果里面需要加载http的资源或者重定向的时候,webview会block页面加载。这应该是android 4.4以来google对安全机制的提升。
所以webview也为开发者增加了新的api。具体错误如下:
[INFO:CONSOLE(0)] “Mixed Content: The page at ‘https://m.wanzhoumo.com/?zmsource=lifecalendar’ was loaded over HTTPS, but requested an insecure image ‘http://cdn.wanzhoumo.com/data/public/operating/2016/03/25_73/14588983970673381.jpg!720x500‘. This request has been blocked; the content must be served over HTTPS.”, source: https://m.wanzhoumo.com/?zmsource=lifecalendar (0)
public static final int MIXED_CONTENT_ALWAYS_ALLOWAdded in API level 21Used with setMixedContentMode(int) 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.Constant Value: 0 (0x00000000)
WebSettings settings = webview.getSettings(); settings.setJavaScriptEnabled(true); settings.setDomStorageEnabled(true); settings.setAllowFileAccess(true); settings.setAppCacheEnabled(true); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); }
如果觉得本人帮助到您,就请客官打赏一下小弟一瓶饮料喽。
4 0
- Android WebView blocks redirect from https to http
- Redirect http to https
- Passenger,nginx and SSL(http redirect to https)
- Redirect all HTTP requests to HTTPS with Nginx
- From HTTP to HTTPS and back
- configuration of tomcat: switch from http protocol to https protocol
- Android WebView使用,Http/Https,硬件加速等相关细节详解
- android 用webview加载网页(https和http)
- Android webview加载https网页时http图片无法显示
- http切换https后redirect跳转过滤
- Android WebView Https
- android webview https blank
- android webview 加载https
- android - How to make a phone call from webview
- http to https additions
- 网站http to https
- Response.Redirect跳转到另外的页面,并用新窗口打开(from:http://stackoverflow.com/questions/104601/asp-net-response-redirect-to-new-window)
- Android webview should overrideUrlLoading and redirect
- 《C#入门经典v6》读书笔记1 C#语言
- 不断更新的庞大家族——Java IO
- 从CU导入到CSDN的博文列表
- 系统重装
- 遍历map
- Android WebView blocks redirect from https to http
- 【一天一道leetcode】 #2 Add Two Numbers
- 欢迎使用CSDN-markdown编辑器
- CSS文字控制之letter-spacing和word-spacing
- 城市平乱
- Realm实战总结---Android
- UVALive 2965-Jurassic Remains (Mitm)中途相遇法+bitmask
- ocx控件注册失败常见问题
- HDOJ 2665 Kth number(归并树)