Mobile HTML rendering numbers

房东的猫 提交于 2019-11-28 10:13:49

I don't know about Android or Nokia, but for iPhone you could use the meta tag:

<meta name="format-detection" content="telephone=no">

to disable detecting anything as a phone number.

Here's how you do it for the iPhone, which seems to work for Android as well; it may work in other browsers, that's all I have to test with at the moment:

<meta name="format-detection" content="telephone=no" />

In case you want to keep the functionality that recognises the phone number as such and allows you to tap it, use this solution:

Since iOS adds a <a href="tel123456789"> tag around the number, all you have to do is make a css rule that styles this tag:

a[href^=tel] { color: inherit; }

credit goes to this Razor Edge Labs article.

Longshot, but, try writing the period as &#46; - there are smart codes that can disable that for mobile safari, etc, but that only works for one-two devices. If you're lucky, you'll bypass their regex.

As discussed in the comments, adding arbitrary spans seems to break detection for the browser in question:

<span>2</span>.837<span>.000</span>

however, an explicit solution in the form of a "don't parse this" attribute or Meta tag would of course be preferable, as it would be more certain to work in the future and for all/most platforms.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!