我正在尝试使用以下锚点标签链接到外部链接: Google。在iOS中使用Phonegap打开外部链接
为了做到这一点,我在appDelegate.m添加该代码(代码是从这里:https://gist.github.com/2012253):
- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)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"]) {
[[UIApplication sharedApplication] openURL:url];
return NO;
}
else {
return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
}
}
,但我不能仍然能够链接到谷歌......上午我做错了什么?需要一些帮助。
您是否正确设置了“ExtrernalHosts”属性?你的网址在应用程序中打开? – dhaval
网址未在应用程序中打开...如何设置外部主机? – lakesh
在您的Cordova.plist文件,详细信息 - http://docs.phonegap.com/en/1.9.0/guide_whitelist_index.md.html#Domain%20Whitelist%20Guide – dhaval