4

So I get this error when I try to validate it here:

Bad value tel:0000 00 00 00 for attribute href on element a: Illegal character in scheme data: not a URL code point

My html looks like this:

<a href="tel:0000 00 00 00">0000 00 00 00</a>

Is there any way to fix this?

unor
  • 92,415
  • 26
  • 211
  • 360
paulalexandru
  • 9,218
  • 7
  • 66
  • 94

3 Answers3

5

Take the spaces out. Literal spaces are not allowed in URLs and they are not part of the data of a phone number, just formatting for human consumption.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
2

Assuming that the validator is checking the URL against the grammar given in RFC 3966, it's failing on the space characters. Remove those, or replace them with a visual-separator character (e.g. -) and you should be okay.

Example:

<a href="tel:0000-00-00-00">0000 00 00 00</a>

Section 3 of the spec has the grammar. In particular:

phonedigit           = DIGIT / [ visual-separator ]
visual-separator     = "-" / "." / "(" / ")"

See also Section 5.1.1, which says

even though ITU-T E.123 recommends the use of space characters as visual separators in printed telephone numbers, "tel" URIs MUST NOT use spaces in visual separators to avoid excessive escaping.

Community
  • 1
  • 1
Toby Speight
  • 27,591
  • 48
  • 66
  • 103
-3

Don't use a hyperlink. Use microdata. Mobile phones will recognize that it is a phone number and allow it to be clicked but it won't affect normal web browsers.

<div class="vcard">
<div class="tel">
    12345555555
</div>

See: https://stackoverflow.com/a/13409099/3462988

Community
  • 1
  • 1
Willem
  • 398
  • 1
  • 6
  • 23
  • What's a "normal" Web browser? Read [this other answer](https://stackoverflow.com/a/13409241/4850040) to your linked question to see why hiding the URL harms users. Plus, your suggestion is unlikely to be checked by the validator, so errors are less easily found (and how Paul ended up here in the first place!). – Toby Speight Aug 07 '15 at 09:57