You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Montyleena (JIRA)" <ji...@apache.org> on 2013/06/04 14:31:20 UTC

[jira] [Updated] (CB-3576) Allowing local https links in InAppBrowser

     [ https://issues.apache.org/jira/browse/CB-3576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Montyleena updated CB-3576:
---------------------------

    Description: 
Local https links are blocked by default in InAppBrowser (links using a local SSL certificate which can't be verified by a 3rd party). Ideally, user should be given an option to proceed or cancel the request like the default desktop/mobile browsers do. 

Can we get this feature in PhoneGap? Other option will be to give a simple API/interface to enable users to open such URLs instead of blocking them by default.

Right now, we have to overwrite the following API in Android to access such URLs but onReceivedSslError() function gets called only for the main PhoneGap window browser and not for InAppBrowser.

Create a new class:
public class CustomWebViewClient extends CordovaWebViewClient {
	
	public static final String LOG_TAG = "Plugin";
	
	public CustomWebViewClient(DroidGap ctx) {
        super(ctx);
        Log.d(LOG_TAG, "Constructor!");
    }
    @Override
    public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    	// Ignore SSL errors and proceed
    	Log.d(LOG_TAG, "Ignoring SSL certificate errors...");
    	handler.proceed();
    }
}

In the main class, use this as a web view client
 CordovaWebViewClient webViewClient = new CustomWebViewClient(this);
        webViewClient.setWebView(this.appView);
        this.appView.setWebViewClient(webViewClient);


And similar type of code needs to be written for iOS.

  was:
Local https links are blocked by default in InAppBrowser (links using a local SSL certificate which can't be verified by a 3rd party). Ideally, user should be given an option to proceed or cancel the request like the default desktop/mobile browsers do. 

Can we get this feature in PhoneGap? Other option will be to give a simple API/interface to enable users to open such URLs instead of blocking them by default.

Right now, we have to overwrite the following API in Android to access such URLs:

public class CustomWebViewClient extends CordovaWebViewClient {
@Override
    public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    	// Ignore SSL errors and proceed
    	Log.d(LOG_TAG, "Ignoring SSL certificate errors...");
    	handler.proceed();
    }
}

And similar type of code needs to be written for iOS.

    
> Allowing local https links in InAppBrowser
> ------------------------------------------
>
>                 Key: CB-3576
>                 URL: https://issues.apache.org/jira/browse/CB-3576
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Plugin InAppBrowser
>    Affects Versions: 2.7.0
>         Environment: Android and iOS
>            Reporter: Montyleena
>            Assignee: Steve Gill
>              Labels: https, ssl
>
> Local https links are blocked by default in InAppBrowser (links using a local SSL certificate which can't be verified by a 3rd party). Ideally, user should be given an option to proceed or cancel the request like the default desktop/mobile browsers do. 
> Can we get this feature in PhoneGap? Other option will be to give a simple API/interface to enable users to open such URLs instead of blocking them by default.
> Right now, we have to overwrite the following API in Android to access such URLs but onReceivedSslError() function gets called only for the main PhoneGap window browser and not for InAppBrowser.
> Create a new class:
> public class CustomWebViewClient extends CordovaWebViewClient {
> 	
> 	public static final String LOG_TAG = "Plugin";
> 	
> 	public CustomWebViewClient(DroidGap ctx) {
>         super(ctx);
>         Log.d(LOG_TAG, "Constructor!");
>     }
>     @Override
>     public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
>     	// Ignore SSL errors and proceed
>     	Log.d(LOG_TAG, "Ignoring SSL certificate errors...");
>     	handler.proceed();
>     }
> }
> In the main class, use this as a web view client
>  CordovaWebViewClient webViewClient = new CustomWebViewClient(this);
>         webViewClient.setWebView(this.appView);
>         this.appView.setWebViewClient(webViewClient);
> And similar type of code needs to be written for iOS.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira