define( 'WPCACHEHOME', '/srv/www/' ); //Added by WP-Cache Manager Network Path Reference (Protocol Relative URL) | Ian Chilton
Home > Web > Network Path Reference (Protocol Relative URL)

Network Path Reference (Protocol Relative URL)

Anyone who has done web development on a site that uses a https:// (SSL) secure connection will be familiar with the annoying “This Page Contains Both Secure and Non-Secure Items” error (or exclamation mark in other browsers) if you include an asset in http:// on the page.

This neat trick, which Paul Irish calls the “Protocol Relative URL”.

If you use // at the beginning of the URL, it will automatically use whichever protocol you are currently using.


<img src="//">
<script src="//"></script>
.myclass { background: url(//;

The only cavet is that you should avoid using it with <link> or @import to include stylesheets as IE7 and IE8 have a bug where it will load the stylesheet twice, which is in-efficient (especially since downloading a stylesheet is a blocking action so it will halt rendering the page while it downloads).

Categories: Web Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.