House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home / Groups / ColdFusion Talk (CF-Talk)

How to prevent cfhtmlhead content from being inserted into cfmail

Author:
Rick Faircloth
05/23/2012 07:46 AM

The JS and CF affected by the commenting is in the onRequestStart function in the application.cfc: <cfsavecontent variable = "jsVariables">    <!--- [ js version of cf variables ] --->               <cfset  js_sitename             =     application.sitename          />    <cfset  js_website              =     application.website           />    <cfset  js_site_manager_dsn     =     application.site_manager_dsn  />    <cfset  js_client_dsn           =     application.client_dsn        />               <cfoutput>                  <script type="text/javascript">                       var  js_sitename          =    '#js_sitename#';          var  js_website           =    '#js_website#';          var  js_site_manager_dsn  =    '#js_site_manager_dsn#';          var  js_client_dsn        =    '#js_client_dsn#';                      </script>                 </cfoutput> </cfsavecontent> <cfhtmlhead text = "#jsVariables#" /> If I use: <cfif listLast(arguments.thepage, '/') is not "employment-application.cfm"> </cfif> around the code above, it prevents the insertion of code into the head of employment-application.cfm, but the lines between and including, "<script type="text/javascript">...</script>" still get inserted into the JSON produced by an AJAX call from employment-application.cfm. cfmail... > Well, apparently, I can conditionally comment out any of the > CF based on the requesting file. However, the JS isn't affected > by the conditional comments and still shows up in the JSON, causing > the JS to stop processing.  Once I remove the JS, the processing > occurs normally. Is your JS in a CFM file? If so, it doesn't matter. CF doesn't care if you output HTML, JS, or Klingon. If it is a CFM or a CFC _file_, then onRequestStart will fire. > PS - I appreciate the tip on "thepage" variable passed onRequestStart. > I didn't find that in the docs, specifically, nor in other Google searches. It is there - in the CFML Reference, chapter 8 (well, for CF10) is: Application CFC Reference


Search cf-talk

May 24, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference