Nov 10, 2018

Protocol-less URLs - a better way to reference third party content that’s available via both HTTP and HTTPS

protocol-less URLs such as:

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

//cdnjs.cloudflare.com/ajax/libs/bootstrap-markdown/2.7.0/js/bootstrap-markdown.js

allow a reference like this to work in every browser. When a URL’s protocol is omitted, the browser uses the underlying document’s protocol instead. 

On a page loaded through regular, un-encrypted HTTP, script references using that URL will be loaded via HTTP and be cached as normal. Likewise, on a secure page that was loaded via HTTPS, script references targeting that protocol-less URL will automatically load the script via HTTPS and avoid the mixed content warning.  

The protocol-less URL allows a single script reference to adapt itself to what’s most optimal: HTTP and it’s full caching support on HTTP pages, and HTTPS on secured pages so that your users aren’t confronted with a mixed content warning.
For more information:  section 4.2 of RFC 3986