0 Replies - 19356 Views - Last Post: 12 January 2013 - 09:21 PM

#1 sdla4ever  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 55
  • Joined: 26-September 11

Sending external html to safari except PHP

Posted 12 January 2013 - 09:21 PM

Ok so I am developing a ios app and I want all external urls to be loaded in safari, except for google and a php file. Here is what I have, how would I add a exception to prevent php from being sent to Safari

Thank you

- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
    NSURL *url = [request URL];
    NSString *host = [request.URL host];
    
    if(host != NULL || host != nil){
        if ([host rangeOfString:@"google.com"].location != NSNotFound) {
            return YES;
        }else{
            if ([[url scheme] isEqualToString:@"https"] || [[url scheme] isEqualToString:@"https"] || [[url scheme] isEqualToString:@"mailto:"]) {
                [[UIApplication sharedApplication] openURL:url];
                return NO;
            }
            else {
                return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
            }
        }
    }
    
    return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
}



Is This A Good Question/Topic? 0
  • +

Page 1 of 1