如何在移动Safari中禁用电话号码链接?

iPhone上的Safari自动为出现在电话号码上的数字字符串创建链接。我正在写一个包含IP地址的网页,Safari正在把它变成一个电话号码链接。是否可以对整个页面或页面上的元素禁用此行为?



蝴蝶不菲
浏览 698回答 3
3回答

HUX布斯

这似乎是正确的做法,根据Safari HTML引用:<meta name="format-detection" content="telephone=no">如果您禁用此功能,但仍然希望使用电话链接,则仍然可以使用“tel”URI方案。

宝慕林4294392

要禁用特定元素的电话解析外观,这个CSS似乎可以做到这一点:.element&nbsp;{&nbsp;pointer-events:&nbsp;none;&nbsp;}.element&nbsp;>&nbsp;a&nbsp;{&nbsp;text-decoration:none;&nbsp;color:inherit;&nbsp;}第一个规则禁用单击,第二个规则负责样式设置。

不负相思意

WebView的解决方案!对于PhoneGap-iPhone/PhoneGap-IOS应用程序,可以通过将以下内容添加到项目的应用程序委托中来禁用电话号码检测:// ...- (void)webViewDidStartLoad:(UIWebView *)theWebView  {     // disable telephone detection, basically <meta name="format-detection" content="telephone=no" />     theWebView.dataDetectorTypes = UIDataDetectorTypeAll ^ UIDataDetectorTypePhoneNumber;     return [ super webViewDidStartLoad:theWebView ];}// ...
打开App,查看更多内容
随时随地看视频慕课网APP