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#://"/>

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

<img src="//"/>

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


Leave Your Comment

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

about me

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