简体   繁体   English

HTML 电话:链接到紧急号码

[英]HTML tel: link to emergency number

How do I create a HTML <a href="tel:"></a> link to an emergency number like 911 or 112 ?如何创建指向紧急电话号码(如911112的 HTML <a href="tel:"></a>链接?

The RFC says RFC 说

The phone number can be represented in either global or local notation.电话号码可以用全局或本地符号表示。 All phone numbers MUST use the global form unless they cannot be represented as such.所有电话号码都必须使用全局形式,除非它们不能这样表示。 [Emergency numbers ("911", "112")] cannot be represented in global form and need to be represented as a local number with a context. [紧急号码(“911”,“112”)]不能以全局形式表示,需要以具有上下文的本地号码表示。

From the local-context section I don't find it easy to understand what a "local-context" is, let alone what the correct one for this case is.本地上下文部分,我发现理解什么是“本地上下文”并不容易,更不用说这种情况下正确的上下文了。 It lists domain prefixes like houston.example.com or a numeric prefix like +1 , and in one paragraph it says它列出了像houston.example.com这样的域前缀或像+1这样的数字前缀,并在一段中说

A context consisting of the initial digits of a global number does not imply that adding these to the local number will generate a valid E.164 number.由全球号码的初始数字组成的上下文并不意味着将这些数字添加到本地号码将生成有效的 E.164 号码。 It might do so by coincidence, but this cannot be relied upon.它可能是巧合,但这不能依赖。 (For example, "911" should be labeled with the context "+1", but "+1-911" is not a valid E.164 number.) (例如,“911”应标有上下文“+1”,但“+1-911”不是有效的 E.164 号码。)

But the phrasing of this paragraph is again very confusing.但是这一段的措辞再次令人困惑。

Is

<a href="tel:+49-112">112</a>

now the correct way of doing it, and the fact that it is not a valid E.164 number is irrelevant?现在这样做的正确方法,以及它不是有效的 E.164 号码这一事实无关紧要?

Or is the fact that it is not a valid E.164 number a problem?或者它不是有效的 E.164 号码是一个问题?

In some other places I see people using 在其他一些地方,我看到人们使用

<a href="tel:112;phone-context=emergency.example.com">112</a>

And again other people recommend 其他人再次推荐

<a href="tel:112;phone-context=+49">112</a>

But when I tap that link on Android, the dialer opens with the number但是当我在 Android 上点击该链接时,拨号器会打开该号码

112;746632668398+49

The cited Section 5.1.5 the RFC states引用的第 5.1.5 节RFC 状态

A context consisting of the initial digits of a global number does not imply that adding these to the local number will generate a valid E.164 number.由全球号码的初始数字组成的上下文并不意味着将这些数字添加到本地号码将生成有效的 E.164 号码。 It might do so by coincidence, but this cannot be relied upon.它可能是巧合,但这不能依赖。 (For example, "911" should be labeled with the context "+1", but "+1-911" is not a valid E.164 number.) (例如,“911”应标有上下文“+1”,但“+1-911”不是有效的 E.164 号码。)

I interpret this that emergency numbers should be prefixed by their country-secific prefixes, ie我的解释是紧急电话号码应该加上他们国家特定的前缀,即

  • in the US, 911 should be used as <a href="tel:+1-911">911</a>在美国, 911应用作<a href="tel:+1-911">911</a>
  • in Germany 112 should be used as <a href="tel:+49-112">112</a>在德国112应用作<a href="tel:+49-112">112</a>

The rest of the paragraph is about this syntax not being compliant to the E.164 recommendation.本段的其余部分是关于此语法不符合 E.164 建议。 As far as I understand, E.164 is irrelevant in this context though.据我所知,E.164 在这种情况下是无关紧要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM