cfhtmlhead reset/unset or cancel?
We have some ColdFusion apps that use the cfhtmlhead tag to add some scripts and random stylesheet link tags... problem is I can't change the files that do this, and my content has to execute along with the code that has the cfhtmlhead calls. Again, not much I can do to get around this.
The only thing I can think of that almost works is to do a <cfcontent reset="true"> which takes care of everything but the lingering <script>...</script> and <link ... /> tags that were added using <cfhtmlhead />
I just need to know if there is a way to reset or cancel anything that has been added via cfhtmlhead to output some text content that can't have script and link tags or any thing else littering the output.
F开发者_开发知识库rom what I have tried/found, it doesn't seem possible. Can someone confirm if this is the case? Am I missing some simple or even hackish solution somewhere?
Thanks to Henry's link and a few other issues I was figuring out at the same time, I got thinking of other ways to hack at it and found this simple solution that works for my original problem as I don't want/need to use content injected via the cfhtmlhead call at all:
<!--- output that doesn't work with the headerText being added to it --->
<cfsavecontent variable="dontLitter">
...
</cfsavecontent>
<cfcontent type="text/html" variable="#toBinary(toBase64(dontLitter))#" />
This works because when using the <cfcontent>
tag with the variable
attribute all previous output is discarded, including anything set with the <cfhtmlhead>
- which is what was needed.
while (getMetaData(out).getName() is 'coldfusion.runtime.NeoBodyContent')
{
out = out.getEnclosingWriter();
}
methods = out.getClass().getDeclaredMethod("initHeaderBuffer",arrayNew(1));
methods.setAccessible(true);
methods.invoke(out,arrayNew(1));
http://www.coldfusiondeveloper.nl/post.cfm/clearing-the-cfhtmlhead-buffer-in-railo
精彩评论