CFLib.org – Common Function Library Project

httpOrS()

Last updated July 29, 2008

author

Alan McCollough

Version: 1 | Requires: CF5 | Library: UtilityLib

Description:
Useful for bulding display pages where you want to provide a non-relative link, such as a link to a .css or .js file. This lets you render the link as HTTPS if the current session is SSL, or as HTTP if the current session is not SSL.

Return Values:
Returns a string.

Example:

Example: <img src="#httpOrS()#://#foo#/someImg.jpg">

Parameters:

No arguments.

Full UDF Source:

/**
 * Returns &quot;https&quot; if the current browser session is via SSL, or &quot;http&quot; if not.
 * 
 * @return Returns a string. 
 * @author Alan McCollough (amccollough@anmc.org) 
 * @version 1, July 29, 2008 
 */
function httpOrS() {   
   if(cgi.server_port_secure IS TRUE) return "https";
   else return "http";
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson