我正在使用以下https://github.com/apache/incubator-cordova-mac來製作mac os x應用程序,但看起來我無法獲取_blank鏈接來打開。如果有人知道那會怎麼樣。cordova mac在safari中打開網址
答案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];
}
}
我得到一個錯誤,當我把我的代碼,我將在 – RussellHarrower
以上編輯嗯,我在Cordova應用程序中使用此功能,而不是在Cordova Mac組件中使用此功能。您可能需要調整代碼以在組件中使用,而不是在應用程序中使用。只要尋找等效的方法。 – codemonkey
任何人都用phonegap 2.x試過這個嗎? – sonjz