cf10 unable to add text to HTML Head
Asked Answered
M

4

12

I am getting the following error on a page we are loading:

coldfusion.runtime.CfErrorWrapper 
Unable to add text to HTML HEAD tag. 
[empty string] 

caused by

Template

Unable to add text to HTML HEAD tag. 
ColdFusion was unable to add the text you specified to the output stream. This is probably because you have already used a CFFLUSH tag in your template or buffered output is turned off.

I've done a sweep of all the files that are included in our application and cannot find anything that uses CFFlush.

output is set to 'no' on all cfcs and components. I also tried adding cfsetting showdebugoutput = no in a file. That didn't help.

I turned request debugging on in cfadmin and that didn't help.

The HTML Head works fine in other parts of our app, it just seems to be on this one page.

The only thing really different about this page is that it is a particularly long page.

Matthewmatthews answered 7/7, 2013 at 21:51 Comment(0)
W
18

If it's a particularly long page, then CF may be flushing the buffer on its own. If you check in the CFAdmin, on the settings page, there is a setting for Maximum Output Buffer size. I believe the default is 1024 KB. If your page is over 1 meg of content, then CF may flush the buffer before your <cfhtmlhead /> tag runs. Try increasing the buffer size, or changing the placement of the <cfhtmlhead /> tag to see if that corrects the issue.

Weltpolitik answered 8/7, 2013 at 13:22 Comment(0)
C
1

I've run into the same problem recently but the behavior wasn't predictable. I believe that Dan Short's answer is correct. I created some test pages to see if I could reproduce the problem. Each time TestTemplate.cfm is included, CFHTMLHEAD writes a simple JavaScript alert to the head tag. Once the buffer is reached, and the page is automatically flushed, any subsequent CFHTMLHEAD tag use will result in an error, specifically, the error in the original post. As Dan indicates, you can work your way around this issue by changing the maximum output buffer size.

file: index.cfm

<html>
<head><title>Test Page</title></head>
<body>
<cfset SampleScript = "<script src='sample.js'></script>"> 
cfset Count = 0>
<cfinclude template="TestTemplate.cfm"> 
<cfinclude template="TestTemplate.cfm"> 
<cfinclude template="TestTemplate.cfm"> 
</body>
</html>

file TestTemplate.cfm

<cfhtmlhead text="#SampleScript#">
<cfset Count++>
<cfoutput>
<h1>Count #Count#</h1>
</cfoutput>

<cfoutput>
<cfloop from="1" to="100000" index="i">
    <cfscript>
    j = randRange(i, 1000000);
    k = randRange(i, 1000000);
    l = j * k;
    writeOutput(l);
</cfscript> 
</cfloop>
</cfoutput>

file sample.js

alert('Boo!');
Chuckwalla answered 7/5, 2014 at 18:31 Comment(1)
We have had this problem as well - one out of every, well, I'm not really sure, but it would have to be in the thousands of calls generating a page that averages 11K will suddenly be too large for no apparent reason. The call's usually a GET call with nothing unusual in the query string. I'm more concerned about what's being returned to the browser than getting the error, however.Alten
A
1

server.log showed another error that I was submitting too many fields with a POST request. I had to increase this limit on the Settings page.

Aquiculture answered 24/8, 2018 at 15:53 Comment(0)
W
0

To fix this, login to Coldfusion Admin, go to Memory Variables, and uncheck 'Disable updating Coldfusion internal cookies using Coldfusion tags/functions.' Save your settings and restart your website.

Wieland answered 21/6, 2017 at 6:52 Comment(2)
you can add the source so that will help to understand clearlyCasa
I still had this issue occur with that item unchecked.Histrionics

© 2022 - 2024 — McMap. All rights reserved.