移动 HTML 渲染数
我有一个移动网页,显示银行对账单。像这样的事情:
DATE | DESCRIPTION | AMOUNT
--------------|--------------------------|---------------
Jan 2nd 2010 | Clothes | USD 1.839.000
Sep 23rd 2010 | Drinks | USD 2.837.000
我使用 .
作为千位分隔符,因为这是我们的区域设置配置。
HTML 非常简单。像这样的事情:
<table>
<tr>
<td>DATE</td>
<td>Clothes</td>
<td>AMOUNT</td>
</tr>
<tr>
<td>Jan 2nd 2010</td>
<td>Clothes</td>
<td>USD 1.839.000</td>
</tr>
<tr>
<td>Sep 23rd 2010</td>
<td>Drinks</td>
<td>USD 2.837.000</td>
</tr>
</table>
我遇到的问题是 iPhone 的 Safari、Android 浏览器和一些诺基亚浏览器正在思考(错误地)数字,例如 1.839.000
和 2.837 .000
是电话号码,因此将它们呈现为拨打电话或发短信的链接。
我的问题:是否有特殊的标签/属性/CSSSTYLE 来告诉移动浏览器将这种文本显示为纯文本?
多谢。
I have a mobile WEB Page showing a bank statement. Something like this:
DATE | DESCRIPTION | AMOUNT
--------------|--------------------------|---------------
Jan 2nd 2010 | Clothes | USD 1.839.000
Sep 23rd 2010 | Drinks | USD 2.837.000
I am using .
as a thousand separator since that's our locale configuration for that.
HTML is very simple. Something like this:
<table>
<tr>
<td>DATE</td>
<td>Clothes</td>
<td>AMOUNT</td>
</tr>
<tr>
<td>Jan 2nd 2010</td>
<td>Clothes</td>
<td>USD 1.839.000</td>
</tr>
<tr>
<td>Sep 23rd 2010</td>
<td>Drinks</td>
<td>USD 2.837.000</td>
</tr>
</table>
The problem I am having is that iPhone's Safari, Android Browsers and some Nokia Browsers are thinking (erroneously) numbers such as 1.839.000
and 2.837.000
are phone numbers hence rendering them as links to make phone calls or do some texting.
My question: Is there a special TAG/ATTRIBUTE/CSSSTYLE to tell mobile browser to show that kind of text as plain text?
Thanks a lot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我不知道 Android 或诺基亚,但对于 iPhone,您可以使用 元标记:
禁用将任何内容检测为电话号码。
I don't know about Android or Nokia, but for iPhone you could use the meta tag:
to disable detecting anything as a phone number.
以下是针对 iPhone 的操作方法< /a>,似乎也适用于 Android ;它可能在其他浏览器中工作,这就是我目前必须测试的:
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:
如果您想保留识别电话号码并允许您点击它的功能,请使用以下解决方案:
由于 iOS 在电话号码周围添加了
标签数字,您所要做的就是制定一个 CSS 规则来设置此标签的样式:
a[href^=tel] { color:继承; }
功劳 这篇 Razor Edge Labs 文章。
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.
不太可能,但是,尝试将句点写为
.
- 有智能代码可以禁用移动 Safari 等,但这只适用于一到两个设备。如果幸运的话,您将绕过他们的正则表达式。Longshot, but, try writing the period as
.
- 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:
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.