我正在使用以下https://github.com/apache/incubator-cordova-mac制作 mac os x 应用程序,但似乎我无法打开 _blank 链接。如果有人知道那会很棒。
答案 1) - 没有用
我把它放在 WebViewDelegate.m -
UIWebViewNavigationType < 是错误
- (BOOL) webView:(WebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
//return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
NSURL *url = [request URL];
// Intercept the external http requests and forward to Safari.app
// Otherwise forward to the PhoneGap WebView
if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"] || [[url scheme] isEqualToString:@"itms-apps"]) {
[[UIApplication sharedApplication] openURL:url];
return NO;
}
else {
return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
}
}