是否在Android上支持SSL的Web视图? [英] Does the Web View on Android support SSL?
问题描述
Android上的的WebView
控件,它支持SSL?
The WebView
control on android, does it support SSL?
我试图加载使用受信任的SSL证书,但网页的的WebView
仅仅是白色的。
I am trying to load a web page that uses a trusted ssl certificate but the WebView
is just white.
有什么建议?
推荐答案
不是专家,正是我可以在网上找到。 从我个人理解,web视图确实支持SSL,但是,空白屏幕是显示web视图不相信该证书是有效的。这可能发生在一个证书是自签名或由未成立于安卓(完全有效的证书不验证)根权威性。在任何情况下,如果你使用的是升级Froyo或更好的,你可以尝试这样的:
Not an expert, just what i could find on the web. from what I understand, the WebView does indeed support ssl, however, the blank screen is an indication that the WebView does not believe that the certificate is valid. This may happen with a certificate that is self-signed or a from a root auth that is not set up in android (perfectly valid cert does not validate). In any case, if you are using froyo or better you can try something like:
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.SslErrorHandler;
import android.net.http.SslError;
...
engine = (WebView) findViewById(R.id.my_webview);
engine.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {
handler.proceed();
}
});
这篇关于是否在Android上支持SSL的Web视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!