Disabling visible links in UIWebView

I have several web views in my application in which I need to be careful to allow further HTML links.

I deny references in the delegate method shouldStartLoadWithRequest. This works great, except for one. In the web view, the links are still highlighted in blue. Therefore, the user naturally believes that they are active links, but when selected, I deny the link from the delegate method. This leads to confusion for the user.

Is there a way to disable the link color, so the text does not appear as blue if it contains the link in UIWebView?

+2
source share
3 answers

Javascript UIWebView, .

href .

Javascript, , :

for(a in document.getElementsByTagName("a")) { a.href= ""; }
+4

:

self.webView.dataDetectorTypes = UIDataDetectorTypeNone;
+2

For quick 3:

Try removing types that you don’t want to show as links from webView.dataDetectorTypes

webView.dataDetectorTypes.remove(UIDataDetectorTypes.all)
+1
source

Source: https://habr.com/ru/post/1736914/


All Articles