iPhone上的Safari会自动为出现在电话号码中的数字字符串创建链接。我正在编写一个包含IP地址的网页,Safari将其转换为电话号码链接。是否可以为整个页面或页面上的某个元素禁用此行为?
当前回答
截至2012年6月13日,这个答案胜过一切:
<a href="#" style="color: #666666;
text-decoration: none;
pointer-events: none;">
Boca Raton, FL 33487
</a>
将颜色更改为与文本匹配的颜色,文本装饰删除下划线,指针事件阻止它像浏览器中的链接一样被查看(指针不会更改为手)
这是完美的HTML电子邮件在ios和浏览器。
其他回答
我的经历和其他人提到的一样。元标签…
<meta name = "format-detection" content = "telephone=no">
...当网站运行在移动Safari(即,chrome),但停止工作时,运行作为一个网络应用程序(即,被保存到主屏幕和运行没有chrome)。
我不太理想的解决方案是将值插入输入字段…
<input type="text" readonly="readonly" style="border:none;" value="3105551212">
这不是很理想,因为尽管边界被设置为none, iOS在字段上方呈现一个多像素的灰色条。但是,这比把数字看作一个链接要好。
另一种选择是将你电话号码中的连字符替换为字符- (U+2011“Unicode非断续连字符”)
将数字分解成不同的文本块
301 <div style="display:inline-block">441</div> 3909
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.
我想我已经找到了一个解决方案:把数字放在<label>元素内。没有尝试任何其他标记,但是<div>使它在主屏幕上处于活动状态,即使有电话=no属性。
从之前的评论中可以明显看出,元标签确实起作用了,但由于某种原因,在iOS的后续版本中,至少在某些条件下,它已经失效了。我运行的是4.0.1。
推荐文章
- 如何在iOS中使用Swift编程segue
- 我如何改变UIButton标题颜色?
- Xcode 4挂在“附加到(应用程序名称)”
- 缺少推荐的图标文件-该包不包含iPhone / iPod Touch的应用程序图标,像素为“120x120”,png格式
- 如何使用Xcode创建。ipa文件?
- Xcode 4 -在新的Macintosh安装上的配置文件上“没有找到有效的签名标识”错误
- 在iPhone上确定用户是否启用了推送通知
- 是否有可能禁用浮动头在UITableView与UITableViewStylePlain?
- Swift -转换为绝对值
- 在代码中为UIButton设置一个图像
- 如何修复UITableView分隔符在iOS 7?
- 在Swift中根据字符串计算UILabel的大小
- 如何调用手势点击在UIView编程在迅速
- 我如何隐藏在一个Swift iOS应用程序的状态栏?
- 对于实例消息,接收方类型***是转发声明