I don't know exactly the difference with Cordovoa but I'm working with PG 1.4.1 and I have this settings in my PhoneGap.plist

And this in my AppDelegate.m
- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = [request URL];
if([[url absoluteString] rangeOfString:@"vimeo.com"].length > 0 || [[url scheme] isEqualToString:@"file"]){
return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
}
[[UIApplication sharedApplication] openURL:url];
return NO;
}
This is my pretty simple index.html opened by PG
<body>
<a href="http://www.vimeo.com">Vimeo</a>
<a href="http://www.google.com">Google</a>
</body>
The vimeo link is opened within the webview and the google link is opened in Safari.
UPDATE Cordova 1.7
Apparently, the shouldSTartLoadWithRequest function is not called in latests versions of PhoneGap/Cordova (from 1.6.1 I think). So, now if you want to open a link within Safari, you need to set the target
attribute a the a tag to _blank
. Since you don't always have access to the code, here's a script to help.
<head>
<script type="text/javascript" src="cordova-1.7.0.js"></script>
<script>
document.onclick = checkLink;
function checkLink(e) {
var url = e.target.href;
if(url.indexOf('vimeo.com') == -1){
window.open(url,'_blank');
}
}
</script>
</head>
<body>
<a href="http://www.vimeo.com">Vimeo</a>
<a href="http://www.google.com" target="_blank">Google</a>
</body>