iPhone上的Safari会自动为出现在电话号码中的数字字符串创建链接。我正在编写一个包含IP地址的网页,Safari将其转换为电话号码链接。是否可以为整个页面或页面上的某个元素禁用此行为?
当前回答
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.
其他回答
要禁用特定元素的电话解析外观,下面的CSS似乎可以做到:
.element { pointer-events: none; }
.element > a { text-decoration:none; color:inherit; }
第一条规则禁止单击,第二条规则负责样式化。
根据Safari HTML参考,这似乎是正确的事情:
<meta name="format-detection" content="telephone=no">
如果您禁用了此功能,但仍然需要电话链接,则仍然可以使用“tel”URI方案。
这里是苹果开发者库的相关页面。
加上这个,我想这就是你想要的:
<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.
Sencha Touch的index.html中的meta标签(<meta name="format-detection" content="telephone=no">)解决了同样的问题。
推荐文章
- 为iPad和iPhone设计输入按钮
- 如何在我的iPhone应用程序中使用NSError ?
- 在整个UIWindow中获取UIView的位置
- Xcode“构建和存档”菜单项被禁用
- 在为设备编译时,Apple Mach-O连接器错误
- 没有找到用于调试模式的此可执行文件的有效配置文件
- 如何从iPhone应用程序发送邮件
- 架构i386的未定义符号:_OBJC_CLASS_$_SKPSMTPMessage",引用自:错误
- 如何使用接口生成器创建的nib文件加载UIView
- 如何为TableView创建NSIndexPath
- 如何比较两个nsdate:哪个是最近的?
- 使UINavigationBar透明
- iOS应用程序“应用程序无法验证”只在一台设备上
- 适用于所有iOS (iPhone/iPad/Apple Watch)设备的大小
- iPhone:如何获取当前毫秒数?