简体   繁体   中英

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 ?

The 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.

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

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.)

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?

Or is the fact that it is not a valid E.164 number a problem?

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

112;746632668398+49

The cited Section 5.1.5 the RFC states

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.)

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>
  • in Germany 112 should be used as <a href="tel:+49-112">112</a>

The rest of the paragraph is about this syntax not being compliant to the E.164 recommendation. As far as I understand, E.164 is irrelevant in this context though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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