cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Achim Staebler (JIRA)" <>
Subject [jira] [Created] (CB-8518) InAppBrowser fails to open external urls in system browser (naive fix included)
Date Fri, 20 Feb 2015 09:57:11 GMT
Achim Staebler created CB-8518:

             Summary: InAppBrowser fails to open external urls in system browser (naive fix
                 Key: CB-8518
             Project: Apache Cordova
          Issue Type: Bug
          Components: Plugin InAppBrowser
    Affects Versions: 0.6.1
         Environment: ios 8.1, tested in ipad air emulator
            Reporter: Achim Staebler

Attempts to open an external url with"", "_system");

fail silently. The root cause is line 91, where an absolute URL is constructed from the app's
base URL and the url passed to

        NSURL* absoluteUrl = [[NSURL URLWithString:url relativeToURL:baseUrl] absoluteURL];

 However, cordova resources are served via file:// scheme, so absoluteURL will be nil in this
case. My suggested fix compares the URL's schemes and skips creating a relative url when this
clearly does not work:

NSURL* absoluteUrl;
        NSURL* urlTarget = [NSURL URLWithString:url];

        if ([urlTarget.scheme isEqualToString:baseUrl.scheme]) {
            // same protocol, can use relative URL Relative to base
            absoluteUrl = [[NSURL URLWithString:url relativeToURL:baseUrl] absoluteURL];
        } else {
            absoluteUrl = urlTarget;

I'm not submitting this as a pull request because I'm not certain about the portential security
implications this native fix might have.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message