我有一个手机间隙应用,可以在儿童浏览器中加载HTML 5应用。子浏览器中加载的页面上的链接也会加载到子浏览器中。我想在Safari中打开这些链接。我怎么能这样做?
由于
答案 0 :(得分:1)
您只需在AppDelegate.m
中添加此内容即可- (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 ];
}
}
希望这有帮助