thtcurlygirl
thtcurlygirl

Reputation: 97

How do I hyperlink a phone number?

I am trying to hyperlink a number (international phone number) on my HTML webpage.

I've looked at tons of other examples online, and mine looks exactly the same so I'm not sure why it's not working :(

<a href="tel:+44 20 7123 4567">+44 20 7123 4567</a>

and here is my error message

enter image description here

Upvotes: 6

Views: 13074

Answers (3)

user12867493
user12867493

Reputation:

HREF links can’t contain spaces.

So your code will look like:

<a href="tel:+442071234567">+44 20 7123 4567</a>

Upvotes: 8

devmike01
devmike01

Reputation: 1987

Remove the space between the numbers in your html. For example: <a href="tel:+442071234567">+44 20 7123 4567</a>.

Upvotes: 0

Dai
Dai

Reputation: 155145

Hyperlinks (the URI in href="") cannot contain spaces. Fortunately E.123 and E.164 (the international phone number standards) do not require spaces or formatting characters either.

You have two options:

  1. Use URI-encoded spaces %20:

    <a href="tel:+44%2020%207123%204567">+44 20 7123 4567</a>
    
  2. Remove spaces:

    <a href="tel:+442071234567">+44 20 7123 4567</a>
    

I prefer #2 because it makes it easier to see the real digits because %20 contains digits.

Upvotes: 1

Related Questions