如何在 Mobile Safari 中禁用电话号码检测

发布于 2024-09-18 00:19:18 字数 267 浏览 4 评论 0原文

我尝试在 Safari 中为我的网络应用程序禁用电话号码检测,但它仍然显示由数字组成的 7 个字符串作为电话号码。我使用了苹果提供的元标记,但没有任何乐趣。

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

还有其他人遇到这个问题并解决它吗?

谢谢。

更新:看起来它在 Safari 中没有检测到电话号码,而是当我将页面保存为图标并从主屏幕运行它时。

I have tried to disable phone number detection in safari for my web app but it still shows 7 character strings comprised of numbers as phone numbers. I used the apple provided meta tag but no joy.

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

Anyone else run into this problem and work around it?

Thanks.

Update: It looks like it does not detect phone numbers in safari but rather when I save the page as an icon and run it from the home screen.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

╄→承喏 2024-09-25 00:19:18

您是否将其加载到 UIWebView 中?如果是这样,您需要设置 dataDetectorTypes 的属性。例如:

webView.dataDetectorTypes = UIDataDetectorTypeNone

有效的检测器类型位于此处。

在苹果网站上搜索 UIWebView 以获取以下描述如何在那里设置属性。

-凯文

Are you loading this in a UIWebView? If so, you need to set the property for dataDetectorTypes. e.g:

webView.dataDetectorTypes = UIDataDetectorTypeNone

Valid detector types are here.

Search for UIWebView on apple's site for a description of how to set the property there.

-Kevin

情未る 2024-09-25 00:19:18

我们的 JQM/Cordova 应用程序也遇到了类似的问题。我们在应用程序中内置了一个计算器,只要金额超过七位数字,数据就会显示为蓝色,下方有下划线,当您单击数据时,会出现一个弹出窗口,让您可以选择拨打电话。我们简单地添加了
元标记如开头问题中所述它起作用了。

只是在这里添加一些想法,以防其他人在 Safari 检测 7 个字符串数据作为电话号码时遇到类似的问题。

We had a similar problem on our JQM/Cordova app. We had a calculator built into the app and whenever the amount was more than seven digits the data would be in blue with an underline underneath and when you click on the data a pop up appeared and gave you the option to call. We simply added
the meta tag as described in the opening question & it worked.

Just adding some thought here in case anybody else has a similar issue with Safari detecting 7 stringed data as telephone numbers.

空城之時有危險 2024-09-25 00:19:18

好的。经过相当多的摸索之后,我想我找到了一个奇怪的解决方法。使用 dataDetectorTypes 的问题是它将禁用整个 uiwebveiw 的电话号码检测。

在尝试了跨度和标签上的 data detectors =“off”和 x-apple-data- detectors =“ false”属性后,我终于偶然发现了一些似乎阻止电话号码检测的东西。

如果我将文本包装在带有 href="#" 的 a 标签中,苹果似乎不会理会它。

OK. After quite a bit of futzing I think I found a strange work around. The problem with using dataDetectorTypes is that it will disable phone number detection for the whole uiwebveiw.

After trying datadetectors="off" and x-apple-data-detectors="false" attribute on span and a tags I finally stumbled on something that seems to prevent phone number detection.

If I wrap my text in an a tag with an href="#" apple seems to leave it alone.

习惯成性 2024-09-25 00:19:18

试试这个代码,

webView.dataDetectorTypes = UIDataDetectorTypeNone;

这可能对你有帮助。

Try this Code,

webView.dataDetectorTypes = UIDataDetectorTypeNone;

This may help you.

最单纯的乌龟 2024-09-25 00:19:18

尝试将其添加到 YourProjectAppDelegate.m

// ...

- (void)webViewDidStartLoad:(UIWebView *)theWebView 
{
    theWebView.dataDetectorTypes = UIDataDetectorTypeAll ^ UIDataDetectorTypePhoneNumber;    
    return [ super webViewDidStartLoad:theWebView ];
}

// ...

对我有用吗..

Try and add this to YourProjectAppDelegate.m

// ...

- (void)webViewDidStartLoad:(UIWebView *)theWebView 
{
    theWebView.dataDetectorTypes = UIDataDetectorTypeAll ^ UIDataDetectorTypePhoneNumber;    
    return [ super webViewDidStartLoad:theWebView ];
}

// ...

Did the trick for me..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文