Blog

http vs. https links

March 11, 2008

Thanks to Tim Jackson for bringing this one to my attention. Since I’ve worked in Coldfusion I’ve always used code similar to this:

<cfset variables.protocol = iif(CGI.SERVER_PORT EQ 443, de("https"), de("http"))>

So that I could avoid the “This page contains unsecure items.” message when embedding Flash, Javascript, images, etc.

<img src="#variables.protocol#://www.foo.com/linkedimage.jpg"/>

Tim advised me that he had found a new way to avoid this without using server-side code:

<img src="//www.foo.com/linkedimages.jpg"/>

Apparently the browser retains the current protocol. I’ve tested this in IE7 and Firefox using images, Flash, anchors, and JavaScript.

0 Comments

Leave Your Comment

Your email address will not be published. Required fields are marked *


about me

An information technology professional with twenty five years experience in systems administration, computer programming, requirements gathering, customer service, and technical support.