机器人的WebView SSL“安全警告” [英] Android WebView SSL 'Security Warning'

查看:165
本文介绍了机器人的WebView SSL“安全警告”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建一个应用程序的测试版客户端。该应用程序的一部分使用的WebView调用了一个基于SSL的站点。反过来,在客户端提供了一个测试域,其中该证书名称不匹配的FQDN。唉,他们不是在一个位置,提供一个证书相匹配。 :(

I'm building a test version of an app for a client. Part of this app uses a WebView that calls out to a SSL-based site. In turn, the client has provided a test domain where the certificate name does not match the FQDN. Alas, they are not in a position to provision a cert that matches. :(

我在解决此问题上的伴侣的iOS特设工作程序与一行code(同样,没有用于生产 - 只是为了测试目的)。我已经寻找Android操作系统的类似信息,但该解决方案我在这里看到的和其他地方都足以让我的头被旋比较大的时候!

I'm working around this issue on the companion iOS ad hoc app with one line of code (again, not for production use - just for test purposes). I have searched for similar info on Android OS, but the solutions I've seen here and elsewhere are enough to make my head spin big time by comparison!

有没有可以解决这个简单的方法?即使是一个面向用户的设置,藏的地方?

Is there a straightforward way to work around this? Even a user-facing setting tucked away somewhere?

线索AP preciated!

Clues appreciated!

推荐答案

创建WebViewClient和处理,看起来像这样的onReceivedSslError:

Create a WebViewClient and handle the onReceivedSslError which looks like this:

public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error)

在这个回调,你可以叫 handler.proceed()键,页面会继续加载。如果你不处理这个回调并调用进行()方法,那么默认的行为将是页面没有加载。

Inside this callback you can just call handler.proceed() and the page will continue loading. If you don't handle this callback and call the proceed() method then the default behaviour will be for the page not to load.

这篇关于机器人的WebView SSL“安全警告”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆