简体   繁体   中英

Can a HTML telephone link accept spaces in the value?

Is there anything wrong or problematic with including spaces as well as a plus symbol (for the international code) in a telephone link? Example:

<a href="tel:+46 000 00 00 00">+46 000 00 00 00</a>

(I replaced the actual number I want to use with 0s here)

HTML is irrelevant here. A URL is a URL no matter where you put it.

The relevant spec says:

even though ITU-T E.123 [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.

So " no ".

Even if a space was allowed, the general rules for URLs would mean that you would have to replace it with %20 (hence the comment about excessive escaping).

Yes it is incorrect to add spaces in telephone numbers on href , according to RFC 3966 (The tel URI for Telephone Numbers):

5.1.1. Separators in Phone Numbers

Phone numbers MAY contain visual separators. Visual separators ('visual-separator') merely aid readability and are not used for URI comparison or placing a call ... "tel" URIs MUST NOT use spaces in visual separators ...

As you can see, the RFC clearly states: "tel" URIs MUST NOT use spaces in visual separators .

there is a full description here in another question.
href="tel:" and mobile numbers

youcan have whatever number format your phone supports. there is no problem with "+" sign you use. but spaces not work in scarce situations.

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