如何在 Mobile Safari 中禁用电话号码检测
我尝试在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您是否将其加载到 UIWebView 中?如果是这样,您需要设置 dataDetectorTypes 的属性。例如:
有效的检测器类型位于此处。
在苹果网站上搜索 UIWebView 以获取以下描述如何在那里设置属性。
-凯文
Are you loading this in a UIWebView? If so, you need to set the property for dataDetectorTypes. e.g:
Valid detector types are here.
Search for UIWebView on apple's site for a description of how to set the property there.
-Kevin
我们的 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.
好的。经过相当多的摸索之后,我想我找到了一个奇怪的解决方法。使用 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.
试试这个代码,
这可能对你有帮助。
Try this Code,
This may help you.
尝试将其添加到 YourProjectAppDelegate.m
对我有用吗..
Try and add this to YourProjectAppDelegate.m
Did the trick for me..