This will remove all html/text output in your page execution prior to running it. Handy if you need to get rid of some white space or, in my case today, output from code that is outside your control.
<cfscript>out = getPageContext().getOut(); method = out.getClass().getDeclaredMethod("initHeaderBuffer",arrayNew(1)); method.setAccessible(true); method.invoke(out,arrayNew(1));</cfscript>
Note: This will not work if a <cfflush> has been executed.
An alternative way is to use <cfcontent reset=”yes”>, which clears the buffer.
Join the discussion