You need to implement the webView:shouldStartLoadRequest:navigationType: delegate method for your web view (Apple Docs).
Here's a quick example:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSURL *url = [request URL];
if ([[url scheme] isEqualToString:@"someLinkURL"]) {
// Display alert
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"Hello" message:@"I'm a message!" delegate:self cancelButtonTitle:@"Okay!" otherButtonTitles:nil];
[myAlert show];
[myAlert release];
return NO;
}
return YES;
}
Your VC must be the webViewDelegate for this method to work.
If you want to handle all clicks manually (i.e. don't go to other pages in the web view) return NO on that final line.