Can a URL start with "//"?
Possible duplicate:
Is it valid to replace with // in a <script src = "...">?
We have a site at http [s]: //A.example.com/, which links to some resources (JS and CSS) at http [s]: //A.example.com/
This makes sense and avoids some browser warnings if the same scheme is used when linking to resources as the main site A is used. Site A uses PHP, so we can programmatically determine the current scheme (http or https) and insert it into the page header.
However, we found that using the // scheme instead of the scheme also works.
Thus, site A can link to "//B.example.com/theme/main.css" without any problems in all browsers we tried, regardless of whether we go to site A using http or https.
My question is: is this a valid URL? This seems to work, but I cannot find anyone else to do this, and I cannot find examples of how this is suggested or recommended.
Yes. It is called the protocol related URL. See Also. Can I change all my http: // links to // only?