|
Mailing Lists
|
Home / Groups / ColdFusion Talk (CF-Talk)
How to prevent cfhtmlhead content from being inserted into cfmailThe 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 |
May 24, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||