【发布时间】:2012-04-20 11:01:58
【问题描述】:
我刚刚升级到 PhoneGap 1.6.1,我无法再获取外部 URL 以在 Safari 中打开。
在此版本之前,我对 AppDelegate.m 进行了如下修补:
- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = [request URL];
if ([[url scheme] isEqualToString:@"http"]) {
[[UIApplication sharedApplication] openURL:url];
return NO;
} else {
return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
}
}
我注意到之前有人问过类似的问题: How can I open an external link in Safari not the app's UIWebView?
但在我看来,这个答案不再适用于 1.6.1 版。
我也尝试在 Cordova.plist 中设置 OpenAllWhitelistURLsInWebView,但没有一个设置给我 Safari。
提前致谢。
【问题讨论】:
-
在此处查看我的 2015 年答案以在 WebView 中打开
_self,在外部浏览器中打开_blank:stackoverflow.com/questions/32208609/…
标签: cordova