iOS UIWebView intercept link click

本小妞迷上赌 提交于 2019-12-04 09:57:10

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/8437305/ios-uiwebview-intercept-link-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!