I have an ipad app, with the majority of the functionality being a web application. The UI is just three UIWebViews that load the pages. Every link that is clicked is intercepted, and I have a request variable in the URL called "iPadTarget."
EX: http://www.somedomain.com/blah.asp?iPadTarget=2
The above code would open in the second webview, because iPadTarget=2.
Here is the code that accomplishes this:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    NSURL *url = [request URL];
    //Extract the value from request variable 'iPadTarget' in url string.
    NSString *test = [url query];
    int index = [test rangeOfString:@"iPadTarget="].location;   
    int target = index + 11;
    char c = [test characterAtIndex:target];
    NSLog(@"%c",c);
    if (navigationType == UIWebViewNavigationTypeLinkClicked || navigationType == UIWebViewNavigationTypeFormSubmitted || navigationType == UIWebViewNavigationTypeOther) {
        if (c == '1') {
            [viewOne loadRequest:request];
            return NO;
        } else if (c == '2') {
            [viewTwo loadRequest:request];
            return NO;
        } else if (c == '3') {
            [viewThree loadRequest:request];
            return NO;
        }
    } 
    return YES;
}
My problem is this: I have a form with an onclick event in a button:
<button onclick='window.open("someotherpage.asp?iPadTarget=2");window.open("someotherpage.asp?iPadTarget=3");'>Button</button>
That code SHOULD open the same page in both the second and third UIWebView. However, it does nothing and when I look at the console output, it prints the char c infinitely.
Sorry for the lengthy question, I will appreciate any help!