„//“ prefix in urls anchor hrefs (protocol relative url)

Beginning an url (anchor href/img source/ …) with „//“ is called protocol relative url and is defined within the RFC 3986.

Using this link notation is helpful if your link must (or should)  use the same protocol as the displayed page.

Examples:

  1. User visits http://www.example.com, all links or image resources should be referenced to the same protocol http.
  2. User visits https://www.example.com, all links or image resources should be referenced to the same protocol https.

A protocol relative url is not restricted to the same url – you may use it to link/refer to other urls as well.