The Protocol-Relative URL

November 8, 2011

Some time back, I came across this excellent nugget of information that Paul Irish has put forth about the protocol-relative URL. I don’t want to reveal the details here (it’s a short article, and you ought to read it), but the gist is that there’s a very simple way to link CSS, images, JavaScript, and whatever other resources so that they’ll be served over HTTP on HTTP pages and provided over HTTPS on HTTPS pages. I wish I had thought to use this when I wrote my e-commerce book (instead of using two different header files)! Sometimes the simple solution is the most brilliant one…