HTML tel: link to emergency number
Asked Answered
V

1

8

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
Villainous answered 4/3, 2018 at 12:50 Comment(2)
That local-context section also says "The parameter value is defined by the assignee of the local number." So, I'm not sure there's a way for the general public (e.g., SO members) to answer that question globally...Hanger
Hi @Nils, have you found a way to make it? I have similar issues and I need a link to 911.Hypogenous
V
2

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, i.e.

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

Villainous answered 4/4, 2020 at 19:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.