I am currently loading a page into a hidden iframe in my phonegap project as a way to clear data from the mobile version of the website that I use in my application.
The problem is that on one particular site there is some type of frame beater and sends a redirect that exits the application and loads the page into mobile safari.
Is there a way to stop the reboot? Leaving the scraping ethic aside :-)
I found the answer in this post http://craigpfau.com/2012/02/phonegap-ios-uiwebview-and-safari-app-links/
Replace it in AppDelegate.m
- (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"
PhoneGap Build, config.xml :
config.xml
<preference name="stay-in-webview" value="true" />
Build, Cordova.plist/Phongap.plist:
Cordova.plist/Phongap.plist
OpenAllWhitelistURLsInWebView = 'Yes'