WebView加载https的空白及图片加载不了的问题
来源:互联网 发布:类似维棠的软件 mac 编辑:程序博客网 时间:2024/06/05 00:56
目前ios现在都需要换成https请求,现在遇到一个webview加载https的有一些问题及解决办法。
1、webview加载https空白页面
解决办法:
@Overridepublic void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { handler.proceed(); // Ignore SSL certificate errors}
或者可以这么写:
@Override public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) { final AlertDialog.Builder builder = new AlertDialog.Builder(this); String message = "SSL Certificate error."; switch (error.getPrimaryError()) { case SslError.SSL_UNTRUSTED: message = "The certificate authority is not trusted."; break; case SslError.SSL_EXPIRED: message = "The certificate has expired."; break; case SslError.SSL_IDMISMATCH: message = "The certificate Hostname mismatch."; break; case SslError.SSL_NOTYETVALID: message = "The certificate is not yet valid."; break; } message += " Do you want to continue anyway?"; builder.setTitle("SSL Certificate Error"); builder.setMessage(message); builder.setPositiveButton("continue", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { handler.proceed(); } }); builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { handler.cancel(); } }); final AlertDialog dialog = builder.create(); dialog.show();}
解决办法:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);}
0 0
- WebView加载https的空白及图片加载不了的问题
- webview加载https页面空白问题
- Android webview 加载自签名的https网页显示空白
- webview 加载https出现的问题
- WebView 加载空白问题
- 解决Webview加载不了https请求中的http图片
- Android WebView加载Html文本不能适配,以及图片中间有空白的问题
- WebView 加载页面空白及加载不全问题
- WebView 加载HttpS 的地址,
- Android WebView加载Html右边空白问题的解决方案
- webview加载网页空白或者不全的问题
- 记录一下:webView加载不了链接的问题
- Android webview 使用HTTPS时有的图片不能加载
- webView加载 https 的网页,不显示图片.md
- Android webview 使用HTTPS时有的图片不能加载
- Android webview 加载https网页显示空白
- Android webview 加载https网页显示空白
- Android webview 加载https网页显示空白
- tabBar隐藏顶端分割线
- git学习好网站
- iOS 常用时间转换
- 随机变量的独立性
- python 2.7 : super()
- WebView加载https的空白及图片加载不了的问题
- Android中自定义圆形头像实现步骤及注意事项
- java-集合排序
- 冷知识让你变得有趣
- KNN分类算法及其改进
- JAXB注解 java 关于xml的注解,自动生成xml文件
- 在Ubuntu下安装jdk解压出现问题:./jdk-6u30-linux-i586.bin: 113: ./install.sfx.3631: not found
- 解决ORA-12514问题
- 推荐一个 blog