Did you know that URLs in HTML attributes can be specified as being protocol relative? I didn’t, until I came across something like this in someone else’s code I was perusing:

<script src="//www.example.com/script.js"></script>

At first I thought this was a mistake, perhaps some sort of copy-paste error. But I soon learned that this is a nifty trick to allow resources (images, scripts, etc.) to load over whatever protocol the containing page is using, either http: or https:.

How is this useful? It ensures your external resources will not generate “mixed content” warnings whenever your page is loaded over a secure (https:) connection. This is particularly evident in IE, whenever a secure page contains references to non-secure resources.

Ned Batchelder has more details.