views:

40

answers:

1

Is there a way to make the action of clicking a link in a html of a UIWebView to load another UIView and pass the value of the url to that view, instead of loading that html page in the same UIWebView. So basically, modify the default action of clicking a link in a UIWebView. Is this possible?

+1  A: 

In your UIWebViewDelegate do this:

- (BOOL)webView:(UIWebView *)webView
  shouldStartLoadWithRequest:(NSURLRequest *)request
  navigationType:(UIWebViewNavigationType)navigationType {

  if ( navigationType == UIWebViewNavigationTypeLinkClicked ) {
    // do something with [request URL]
    return NO;
  }
  return YES;
}
drawnonward