HTML 电话:link 转紧急电话

HTML tel: link to emergency number

如何创建 HTML <a href="tel:"></a> link 到 911112 等紧急号码?

RFC says

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.

local-context section 我发现理解“本地上下文”是什么并不容易,更不用说对于这种情况的正确理解是什么了。它列出了像 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. 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.)

但是这一段的措辞又很混乱。

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

现在是正确的方法,它不是有效的 E.164 号码这一事实无关紧要吗?

或者它不是有效的 E.164 号码是个问题吗?

In some other places 我看到人们在使用

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

再一次other people recommend

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

但是当我在 Android 上点击 link 时,拨号器会打开号码

112;746632668398+49

引用的 Section 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. 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 应用作 <a href="tel:+1-911">911</a>
  • 在德国 112 应该用作 <a href="tel:+49-112">112</a>

该段的其余部分是关于此语法不符合 E.164 建议的。据我了解,E.164 在这种情况下是无关紧要的。