1

Ok so I am working on a cordova app and I am using this bit of code below to prevent external urls from opening in the web view. But I have exceptions in there to allow the iframe from google to load. My problem is that my form script is not handled properly now, so how would I add a exception to prevent php files from being sent to the external app.

I would also like the mail app to handle mailto: urls.

Thanks for the help

- (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];
}
4

0 に答える 0