戴夫·沃德说,
It’s not exactly light reading, but section 4.2 of RFC 3986 provides for fully qualified URLs that omit protocol (the HTTP or HTTPS) altogether. When a URL’s protocol is omitted, the browser uses the underlying document’s protocol instead. Put simply, these “protocol-less” URLs allow a reference like this to work in every browser you’ll try it in: //ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js It looks strange at first, but this “protocol-less” URL is the best way to reference third party content that’s available via both HTTP and HTTPS.
这当然可以解决我们在HTTP页面上看到的一堆混合内容错误——假设我们的资产可以通过HTTP和HTTPS使用。
这是完全跨浏览器兼容的吗?还有其他注意事项吗?