Content: What is :// ?

Created on 14 Jan 2021  Â·  9Comments  Â·  Source: mdn/content

All 9 comments

Good point. My understanding is that they are separators marking the end of the scheme (could be wrong). IN any case, possibly the term scheme is more appropriate than _protocol_ here, and by way of example we should use https rather than http.

To address what @hamishwillee mentioned, With the following URI: foo://bar.com:8042/some/path?filter=cats#orange

  • The scheme is foo
  • The authority is bar.com:8042
  • The path is /some/path
  • The query is filter=cats
  • The fragment is orange

So I do agree, the scheme ends at the start of ://.

To explain the semantics of ://, as described in the RFC - Section 3. If there is a // in a URL, it means that what follows is the _authority_. The colon : is simply a delimiter.

If a scheme uses an _authority_, it will use the // after the : colon. If a URI doesn't use or require an authority, it will not use the //.

As a note, the generic URI syntax (referred to as the scheme, authority, path, query, and fragment) looks like this:

URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

An example of a URI that doesn't use an authority would be mailto:[email protected]. Which wouldn't require // since it doesn't use an authority.

If it did then it would look like mailto://[email protected] which doesn't make much sense.

@chrisdavidmills If you think my above description helps to "describe" what the :// does in the URI, I'm happy to add some details to the page from RFC - Section 3

I could be wrong, but I think, the : belongs to the scheme.
I also vaguely recall, that Sir Tim Berners-Lee mentioned in an interview, that the // is the only thing they regret when launching the WWW.
It adds more noise than anything else.

I can imagine, it was used to separate from the root of an UNIX file system (which would be /).

Hi @tannerdolby I've assigned to you - a PR would be great thanks. We can then discuss the detail based on concrete changes :-)

@Ryuno-Ki The : doesn't belong to the scheme as described in the RFC. It can just be thought of as just a separator or delimiter. To be succinct, it's more of a indicator for the end of the scheme and the start of the hier-part, so it "separates" the scheme and hier-part.

I also vaguely recall, that Sir Tim Berners-Lee mentioned in an interview, that the // is the only thing they regret when launching the WWW.

You are correct about the above. Sir Tim Berners-Lee did mention the // is the thing they regretted when launching the WWW. The // really doesn't have any use other than for URIs with authority like I mentioned above. "The authority component is preceded by a double slash ("//")".

I can imagine, it was used to separate from the root of an UNIX file system (which would be /).

I can't say for certain what their thoughts were but yes, the relative part / is distinctly different than //.

Hi @hamishwillee Ok great. I will write up a PR for this and we can then discuss the detail. Thanks :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yukulele picture yukulele  Â·  4Comments

Elchi3 picture Elchi3  Â·  4Comments

sanoodles picture sanoodles  Â·  3Comments

0xdevalias picture 0xdevalias  Â·  3Comments

chunkybanana picture chunkybanana  Â·  3Comments