iPhone上的Safari会自动为出现在电话号码中的数字字符串创建链接。我正在编写一个包含IP地址的网页,Safari将其转换为电话号码链接。是否可以为整个页面或页面上的某个元素禁用此行为?
当前回答
我的经历和其他人提到的一样。元标签…
<meta name = "format-detection" content = "telephone=no">
...当网站运行在移动Safari(即,chrome),但停止工作时,运行作为一个网络应用程序(即,被保存到主屏幕和运行没有chrome)。
我不太理想的解决方案是将值插入输入字段…
<input type="text" readonly="readonly" style="border:none;" value="3105551212">
这不是很理想,因为尽管边界被设置为none, iOS在字段上方呈现一个多像素的灰色条。但是,这比把数字看作一个链接要好。
其他回答
为什么要删除链接,这使得它非常用户友好的选择。
如果你只是想删除自动编辑,但保持链接工作,只需添加到您的CSS…
a[href^=tel] {
color: inherit;
text-decoration:inherit;
}
我的经历和其他人提到的一样。元标签…
<meta name = "format-detection" content = "telephone=no">
...当网站运行在移动Safari(即,chrome),但停止工作时,运行作为一个网络应用程序(即,被保存到主屏幕和运行没有chrome)。
我不太理想的解决方案是将值插入输入字段…
<input type="text" readonly="readonly" style="border:none;" value="3105551212">
这不是很理想,因为尽管边界被设置为none, iOS在字段上方呈现一个多像素的灰色条。但是,这比把数字看作一个链接要好。
加上这个,我想这就是你想要的:
<meta name = "format-detection" content = "telephone=no">
I too have this problem: Safari and other mobile browsers transform the VAT IDs into phone numbers. So I want a clean method to avoid it on a single element, not the whole page (or site). I'm sharing a possible solution I found, it is suboptimal but still it is pretty viable: I put, inside the number I don't want to become a tel: link, the ⁠ HTML entity which is the Word-Joiner invisible character. I tried to stay more semantic (well, at least a sort of) by putting this char in some meaning spot, e.g. for the VAT ID I chose to put it between the different groups of digit according to its format so for an Italian VAT I wrote: 0613605⁠048⁠8 which renders in 06136050488 and it is not transformed in a telephone number.
另一种选择是将你电话号码中的连字符替换为字符- (U+2011“Unicode非断续连字符”)
推荐文章
- 保留HTML字体大小时,iPhone的方向从纵向改变为横向
- iPhone上UIView和UILabels的渐变
- keychain上的分发证书中缺少私钥
- 如何创建一个Swift Date对象?
- Xcode 4在目标设备上说“finished running <my app>”——什么都没有发生
- 从另一个应用程序打开设置应用程序
- 当我没有Mac的时候,在Mac/Safari上测试web应用程序
- Xcode 6 gitignore文件应该包括什么?
- 如何在iPhone/iOS上删除电话号码的蓝色样式?
- 检测视网膜显示
- 如何在UIImageView中动画图像的变化?
- 如何从iPhone访问SOAP服务
- 如何从iOS应用程序启动Safari和打开URL
- QuotaExceededError: Dom异常22:试图向存储添加一些超出配额的东西
- 在Objective-C中@property保留,赋值,复制,非原子