Most if not all browsers support the following notation:
<script src="//domain.com/script.js">
The //
notation means use the same protocol as the current one, i.e.:
http://domain.com/script.js
if the current page has been served over HTTPhttps://domain.com/script.js
if the current page has been served over HTTPS
This notation works with other HTML tags as well: <a>
, <link>
, etc.
Is this notation also valid for the Location
header?
For example, is it valid to reply this:
HTTP/1.0 301 Moved Permanently
Location: //domain.com/other-resource