aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phonegap/iPhone/FixMyStreet/Classes/AppDelegate.m12
1 files changed, 11 insertions, 1 deletions
diff --git a/phonegap/iPhone/FixMyStreet/Classes/AppDelegate.m b/phonegap/iPhone/FixMyStreet/Classes/AppDelegate.m
index 8faa38ca6..6a7defb8c 100644
--- a/phonegap/iPhone/FixMyStreet/Classes/AppDelegate.m
+++ b/phonegap/iPhone/FixMyStreet/Classes/AppDelegate.m
@@ -180,7 +180,17 @@
- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
- return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType: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 [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
+ }
}
- (void) dealloc