-1

I read this answer, that explains that links starting with // are used to maintain the procotol (http or https).

Is this something defined in a standard or RFC? Or is it just a hack implemented by browsers? I think it's useful, but before using it I want to make sure it is understood by all browsers.

Community
  • 1
  • 1
Ottavio Campana
  • 4,088
  • 5
  • 31
  • 58

1 Answers1

2

It's in the RFC 3986:

From 4.2:

relative-ref = relative-part [ "?" query ] [ "#" fragment ]

  relative-part = "//" authority path-abempty

And:

5.4.1. Normal Examples

...

"//g" = "http://g"

So it is part of the standard, and used my all current browsers.

Community
  • 1
  • 1
Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325