iOS UIWebView intercept link click
14,662
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.
Related videos on Youtube
Author by
ghiboz
c# programmer for work, php, objective-c, c++ programmer for passion
Updated on June 04, 2022Comments
-
ghiboz over 1 year
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.
-
fatdragon over 8 yearsI need to retrieve the content to memory only, examine it and if it's ok then display it in UIWebView. Is that possible?
-
Chris Wagner over 8 yearsYou might want to use an
NSURLConnection
to download the content do you check, and then load that from disk into a webview if I understand correctly.