Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1498

Can a URL start with "//"? [duplicate]

$
0
0

Possible Duplicate:
Is it valid to replace with // in a <script src=“…”>?

We have a site on http[s]://A.example.com/ that references some resources (JS and CSS) on http[s]://A.example.com/

It makes sense, and avoids some browser warnings, if the same scheme is used when referencing the resources as the main site A is using. Site A uses PHP, so we can programmaticly detect the current scheme (http or https) and insert that into the header of the page.

However, we have found that just using '//' instead of the scheme also works.

So site A may reference "//B.example.com/theme/main.css" without a problem in all browsers we have tried, regardless of whether we go to site A using http or https.

My question is: is this a valid URL? It seems to work, but I cannot find anyone else doing it, and I cannot find any examples of this being suggested or recommended.


Viewing all articles
Browse latest Browse all 1498

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>