停止iframe在phonegap项目中redirect/打开移动Safari

目前,我一直在我的phonegap项目中加载一个页面到隐藏的iframe作为从我的应用程序中使用的移动版本的网站的数据刮取的方式。

问题是,一个特定的网站有一些types的框架,并发送redirect退出应用程序,并在移动Safari浏览器加载页面。

有没有办法停止重新加载? 抛开抛弃的道德观念:-)

如果您使用PhoneGap Build,请将其添加到您的config.xml文件中:

 <preference name="stay-in-webview" value="true" /> 

如果您不使用Build,请在您的Cordova.plist/Phongap.plist

 OpenAllWhitelistURLsInWebView = 'Yes' 

我在这篇文章中find了答案http://craigpfau.com/2012/02/phonegap-ios-uiwebview-and-safari-app-links/

在AppDelegate.m中replace这个

 - (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest: (NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType { NSURL *url = [request URL]; if ([[url absoluteString] rangeOfString:@"URLToOpenInUIWebView.com"].location != NSNotFound) { return YES; } else { return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType]; } } 

你不想在UIwebview中使用target =“_ blank”