Suppose I have the following link tag: <a href="tel:+15555555">Phone number</a>
.
How exactly does the browser know not to load the relative location ./tel:+15555555
from the current server and instead know that tel
is supposed to be interpreted as a scheme?
Detecting host-relative URLs (/…
) or protocol-relative URLs (//…
) seems to be trivial. I guess HTTP-URLs (http://…
or https://…
) would be simple to special-case as well. But how does the browser go about parsing an URL with an arbitrary scheme? I know a valid scheme has to start with a lowercase letter and may only contain lowercase letters or the characters +
, -
and .
, which limits the scope somewhat…
Of course I’m aware that the whole issue only pertains to scopes where relative URLs are valid (i.e. mostly the href
and src
attributes).
I’m looking for the links to some RFC (e.g. which forbids non-URL-encoded colons to be anything but scheme separators) as well as to the source code of various browser’s URL parsing internals.