如何从UIWebView中删除链接?

时间:2021-09-03 02:46:51

I'm using UIWebView on my iPhone application. How do I remove the links that ios put by it self. For example I have some double value and ios think it's a phone number and highlighting it!

我在iPhone应用程序上使用UIWebView。如何删除ios自己设置的链接。例如,我有一些双重值,ios认为它是一个电话号码,并突出显示它!

I try to disable the user interaction from the xib file. Didn't help. Can someone help me.

我尝试从xib文件中禁用用户交互。没有帮助。有人能帮助我。

2 个解决方案

#1


7  

In the <head> of the html, you can put:

在html的中,可以输入:

<meta name="format-detection" content="telephone=no">

Safari HTML Reference:

Safari HTML引用:

By default, Safari on iOS detects any string formatted like a phone number and makes it a link that calls the number. Specifying telephone=no disables this feature.

默认情况下,Safari在iOS上检测任何格式化为电话号码的字符串,并将其设置为一个调用该号码的链接。指定phone=no禁用此特性。

Or to unset this detection from a web view programatically using the dataDetectorTypes mask:

或使用dataDetectorTypes掩码程序从web view中取消此检测:

webView.dataDetectorTypes &= ~UIDataDetectorTypePhoneNumber;

#2


1  

Have you tried to change the dataDetectorTypes value ?

您是否尝试过更改dataDetectorTypes值?

You can use this property to specify the types of data (phone numbers, http links, email address, and so on) that should be automatically converted to clickable URLs in the web view. When clicked, the web view opens the application responsible for handling the URL type and passes it the URL.

可以使用此属性指定应该在web视图中自动转换为可单击url的数据类型(电话号码、http链接、电子邮件地址等)。单击时,web视图将打开负责处理URL类型的应用程序并将URL传递给它。

See more details here: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html#//apple_ref/occ/instp/UIWebView/dataDetectorTypes

查看更多细节:http://developer.apple.com/library/ios/#文档/uikit/reference/UIWebView_Class/ reference/ Reference.html#/ apple_ref/occ/instp/UIWebView/dataDetectorTypes

#1


7  

In the <head> of the html, you can put:

在html的中,可以输入:

<meta name="format-detection" content="telephone=no">

Safari HTML Reference:

Safari HTML引用:

By default, Safari on iOS detects any string formatted like a phone number and makes it a link that calls the number. Specifying telephone=no disables this feature.

默认情况下,Safari在iOS上检测任何格式化为电话号码的字符串,并将其设置为一个调用该号码的链接。指定phone=no禁用此特性。

Or to unset this detection from a web view programatically using the dataDetectorTypes mask:

或使用dataDetectorTypes掩码程序从web view中取消此检测:

webView.dataDetectorTypes &= ~UIDataDetectorTypePhoneNumber;

#2


1  

Have you tried to change the dataDetectorTypes value ?

您是否尝试过更改dataDetectorTypes值?

You can use this property to specify the types of data (phone numbers, http links, email address, and so on) that should be automatically converted to clickable URLs in the web view. When clicked, the web view opens the application responsible for handling the URL type and passes it the URL.

可以使用此属性指定应该在web视图中自动转换为可单击url的数据类型(电话号码、http链接、电子邮件地址等)。单击时,web视图将打开负责处理URL类型的应用程序并将URL传递给它。

See more details here: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html#//apple_ref/occ/instp/UIWebView/dataDetectorTypes

查看更多细节:http://developer.apple.com/library/ios/#文档/uikit/reference/UIWebView_Class/ reference/ Reference.html#/ apple_ref/occ/instp/UIWebView/dataDetectorTypes