Note: below solution just for not using InAppBrowser plugin,

When InAppBrowser plugin was add correctly, simply call open.window(url,"_system") will open url in new Browser.

First check your your config.xml , You can define your whiteList by change , for detail how to do it, please check and will make any url not in white list be open in new safari window instand of InWebView.

If your url is in your white list (ex, you use * make all urls are allowed) but you want to open some url in safari, You have to add extra code to do that.

My solution is like below: first I define a function to open safary url:

LaunchNewWindow: function (url) {       
   if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) {    "#_external", "_blank");}
   else{, "_blank");

then you have to change code in CordovaLic\Classses\CDViewController.m to handle your spacial url: I added it in line685 :

else {

// start stoneskin's change: force open external url in safari                              
               if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"]) {
NSString *myurlstr = [url absoluteString];
if ([myurlstr rangeOfString:@"#_external"].location != NSNotFound){
myurlstr = [myurlstr stringByReplacingOccurrencesOfString:@"#_external" withString:@""];
NSURL *myurl = [NSURL URLWithString:myurlstr];
[[UIApplication sharedApplication] openURL:myurl];
return NO;
//end start stoneskin's change if ([self.whitelist schemeIsAllowed:[url scheme]]) { return [self.whitelist URLIsAllowed:url]; } else { if ([[UIApplication sharedApplication] canOpenURL:url]) { [[UIApplication sharedApplication] openURL:url]; } else { // handle any custom schemes to plugins [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]]; } } return NO; }
Don't forget this code only working for Phonegap wrapped app.

Comments are closed.