Reputation: 8003
Is it possible intercept when a user clicks a link in a UIWebView and retrieve the link?
I wish to block the UIWebView from going to the clicked link and do something else.
Thanks in advance.
Upvotes: 25
Views: 14922
Reputation: 21013
Yes, look at the UIWebViewDelegate Protocol Reference, specifically webView:shouldStartLoadWithRequest:navigationType:
The NSURLRequest
will let you know where the link they clicked is going to direct them.
You would simply return NO
on this method if you want to prevent the request from loading.
Upvotes: 43