You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2013/07/12 02:28:58 UTC

git commit: [CB-3947] iTunes links do not open with inappbrowser

Updated Branches:
  refs/heads/master ed332b1e9 -> b4059a2c6


[CB-3947] iTunes links do not open with inappbrowser


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/b4059a2c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/b4059a2c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/b4059a2c

Branch: refs/heads/master
Commit: b4059a2c683c486f1fb48b182ceb9a48fbc59f6e
Parents: ed332b1
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu Jul 11 17:28:39 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Jul 11 17:28:54 2013 -0700

----------------------------------------------------------------------
 src/ios/CDVInAppBrowser.m | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/b4059a2c/src/ios/CDVInAppBrowser.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m
index bbdc497..4170dd2 100644
--- a/src/ios/CDVInAppBrowser.m
+++ b/src/ios/CDVInAppBrowser.m
@@ -59,6 +59,15 @@
     self.callbackId = nil;
 }
 
+- (BOOL) isSystemUrl:(NSURL*)url
+{
+	if ([[url host] isEqualToString:@"itunes.apple.com"]) {
+		return YES;
+	}
+	
+	return NO;
+}
+
 - (void)open:(CDVInvokedUrlCommand*)command
 {
     CDVPluginResult* pluginResult;
@@ -72,6 +81,11 @@
     if (url != nil) {
         NSURL* baseUrl = [self.webView.request URL];
         NSURL* absoluteUrl = [[NSURL URLWithString:url relativeToURL:baseUrl] absoluteURL];
+        
+        if ([self isSystemUrl:absoluteUrl]) {
+            target = kInAppBrowserTargetSystem;
+        }
+
         if ([target isEqualToString:kInAppBrowserTargetSelf]) {
             [self openInCordovaWebView:absoluteUrl withOptions:options];
         } else if ([target isEqualToString:kInAppBrowserTargetSystem]) {