You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "jcesarmobile (JIRA)" <ji...@apache.org> on 2015/04/19 12:23:59 UTC

[jira] [Closed] (CB-8518) InAppBrowser fails to open external urls in system browser (naive fix included)

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

jcesarmobile closed CB-8518.
----------------------------
    Resolution: Cannot Reproduce

Can't reproduce and issue author didn't answer after 2 weeks

> InAppBrowser fails to open external urls in system browser (naive fix included)
> -------------------------------------------------------------------------------
>
>                 Key: CB-8518
>                 URL: https://issues.apache.org/jira/browse/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
>            Assignee: jcesarmobile
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Attempts to open an external url with
> window.open("http://www.apache.org", "_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 window.open:
> {code}
>         NSURL* absoluteUrl = [[NSURL URLWithString:url relativeToURL:baseUrl] absoluteURL];
> {code}
>  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:
> {code}
> 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;
>         }
> {code}
> 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
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org