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";
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson