Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 18 additions & 42 deletions src/site/device-access/click-to-call/click-to-call.markdown
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
---
layout: article
title: "Click to call"
description: "On devices with phone capabilities, make it easy for users to
directly connect with you by simply tapping a phone number, more commonly
known as click to call."
introduction: "On devices with phone capabilities, make it easy for users to
directly connect with you by simply tapping a phone number, more commonly
known as click to call. "
translator: "转二"
reviewer: "祁涛"
description: "在具有电话功能的设备上,用户可以通过轻轻点击一串电话号码来方便地直接联系你,这功能被称作 Click to call。"
introduction: "在具有电话功能的设备上,用户可以通过轻轻点击一串电话号码来方便地直接联系你,这功能被称作 Click to call。"
article:
written_on: 2014-06-17
updated_on: 2014-06-17
Expand Down Expand Up @@ -35,66 +33,44 @@ key-takeaways:

{% include modules/takeaway.liquid list=page.key-takeaways.c2c %}

## Link telephone numbers for click to call
## 为电话号码创建 'click to call' 功能的链接

While many modern mobile browsers will automatically detect phone numbers
and convert them to links, it’s a good idea to do this directly in your code.
By manually tagging each phone number, you can ensure phone numbers are always
enabled for click to call and that they will be styled to match your site.
虽然许多现代移动浏览器会自动检测到电话号码并将其转换为链接,但直接在你的代码里做到这一点是个更好的好主意。通过代码手动标记每个电话号码,就可以确保始终启用 click to call 功能,而且这些号码将被样式化来搭配你的网站。

To mark a phone number as a link, use the `tel:` scheme. The syntax is
simple:
用 `tel:` 格式来标记一串电话号码成一个链接。语法很简单:

{% highlight html %}
NIST Telephone Time-of-Day Service <a href="tel:+1-303-499-7111">+1 (303) 499-7111</a>
{% endhighlight %}

Results in:
结果是:

NIST Telephone Time-of-Day Service <a href="tel:+1-303-499-7111">+1 (303) 499-7111</a>

<img src="images/click-to-call_framed.jpg" class="center" alt="Click to call example.">

On most devices with telephone capabilities, the user will receive a
confirmation before the number is dialed, to ensure users are not being
tricked into calling expensive long distance or premium phone numbers.
When the device doesn’t support phone calls, users may be presented with a
menu allowing them to choose how the browser should handle the number.
大多数具有电话功能的设备上, 号码在被拨打之前用户将会收到一条确认,确保用户不是正在被欺骗而拨打价格昂贵的长途或者溢价的电话号码。当设备不支持电话呼叫功能时,用户可能会看到一个菜单来让他们选择如何让浏览器处理这些号码。

Desktop browsers that don’t support voice calls will open the default
telephony app on the computer, for example Google Voice or Microsoft
Communicator.
对于不支持语音呼叫的桌面浏览器会打开在计算机上默认的电话服务应用程序,比如 Google Voice 或者 Microsoft Communicator。

## Use the international dialing format
## 使用国际拨号格式

Always supply the phone number using the international dialing format:
the plus sign (+), country code, area code and number. While not absolutely
necessary, it’s a good idea to separate each segment of the number with a
hyphen (-) for easier reading and better auto-detection.
始终使用国际拨号格式来提供电话号码:加号(+),国家代码,地区代码和号码。虽然不是绝对必要的,但使用连字符(-)来分开每个数字段来方便您阅读和更好地被设备自动检测是个好习惯。

Using a hyphenated international dialing format ensures that no matter where
the user is calling from, whether a few hundred meters away or thousands
of kilometers, their call will be connected.
使用连字符连接的国际拨号格式,无论是在哪里呼叫,不论距离几百米甚至上千公里远,都可保证用户的呼叫可以被连接。

## Disable auto-detection when necessary
## 在必要时禁用自动检测

Modern mobile browsers will automatically detect phone numbers and enable
click to call. Mobile Safari automatically converts phone numbers to links
with the associated hyperlink styles. Chrome for Android will automatically
detect phone numbers and will allow users to click to call, but does not wrap
them in hyperlinks or apply any special styles.
现代移动浏览器会自动检测电话号码,并启用 click to call。移动端 Safari 会自动将电话号码转化为关联超链接样式的链接。安卓端 Chrome 浏览器会自动检测到电话号码并允许用户 click to call,但不会把号码包裹在超链接中,也不会对号码使用特殊的样式。

To prevent Mobile Safari from automatically detecting phone numbers, add the
following meta tag to the top of the page:
为了阻止移动端 Safari 自动检测电话号码,在页面代码顶部添加以下 meta 标签:

{% highlight html %}
<meta name="format-detection" content="telephone=no">
{% endhighlight %}

## Other click to call features
## click to call 的其他特点

In addition to the `tel:` schema, some modern browsers also support the `sms:`
and `mms:` schemas, though support is not as consistent, and some
features like setting the message body don't always work.
除了 `tel:` 格式, 一些现代浏览器也支持 `sms:` 和 `mms:` 格式,但是这些支持并不一致,而且像设置 message body 等一些功能时也不总是奏效的。

{% endwrap %}