绕过InAppBrowser Cordova插件中的SSL错误 [英] Bypass SSL Error in InAppBrowser Cordova Plugin

查看:278
本文介绍了绕过InAppBrowser Cordova插件中的SSL错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将一个InAppBrowser插件添加到Cordova项目中以访问网站并获取令牌,但是当桌面浏览器中的网站正常打开时,从移动浏览器打开时也会出错。

I have added an InAppBrowser plugin into a Cordova project to access a site and get token but while the site is opening normally in desktop browsers the same is giving error while opening from mobile browser.

此外,默认的本机浏览器会在SSL出现错误时继续请求继续,但Cordova InAppBrowser不会要求此类选项,而是显示错误页面。我使用以下代码打开IAB:

Also the default native browser will ask to continue in case of SSL error but the Cordova InAppBrowser is not asking for such option and instead showing an error page. I am opening the IAB using the following code :

var iab = window.open('http://www.example.com', '_blank', 'location=yes');

如何绕过InAppBrowser中的SSL错误?

Any idea on how to bypass SSL erros in InAppBrowser ?

推荐答案

我将扩展相关问题的答案( phonegap inappbrowser https pages not loading )。这只适用于Android,抱歉仍在iOS上工作。

I'm going to expand on the answer to the related question (phonegap inappbrowser https pages not loading). This pertains only to Android, sorry still working on iOS.

添加此代码:

    public void onReceivedSslError(WebView view,
                SslErrorHandler handler, SslError error) {
        Log.e("Error", "Received SSL error"+ error.toString());
        handler.proceed();
    }

来自插件的InAppBrower.java文件。具体来说,它应该在InAppBrowserClient类下。

to the InAppBrower.java file from the plugin. Specifically, it should be under the InAppBrowserClient class.

希望这会有所帮助!

这篇关于绕过InAppBrowser Cordova插件中的SSL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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