Ah. I remember this. I wrote an internal paper for MedSeek regarding this bug. :P
This only happens under these conditions: 1) MS Internet Explorer as the browser. 2) CFLOCATION is called AFTER CFHTMLHEAD has been called. To be really sure, I think CFHTMLHead should not be in the same CFM Template as the call to CFLOCATION, but I am not sure if this is really a factor. 3) Tested to exist in CF5. Have not tested with MX. Timeline of how this happens: 1) Browser makes request for the CFM that has CFHTMLHead and CFLOCATION. 2) Server executes CFHTMLHead and store the string in a "special" buffer. 3) Server executes CFLOCATION, dumps the buffer in 2 to the output buffer, then dumps the "standard" HTTP header and HTML text (for backwards compatibility for braindead browsers such as Mosaic 2.0) for a HTTP 302 (Object Moved). 4) The HTTP header in 3 miscalculates the length of the HTTP payload, and only accounted for the HTML text in 3, and not the other stuff in 2 (the CFHTMLHead buffer). Hence, the Content-Length header is totally wrong. 5) MS I.E. thinking it is all hot and cool, decided to TRUST the Content-Length in 4, and clears its buffer by the amount specified in Content-Length, and hence, did not clear the CFHTMLHead stuff that it received from the server. 6) Then MS I.E. dutifully picked up the following page based on the "Location" HTTP header, and then dumped everything to the HTML rendering engine which includes the HTML from the final page prepended with the uncleared buffer in 2. Hence, you get the junky stuff on top of the page. Lesson? Try not to use CFHTMLHead until you are really really sure that it is the FINAL page and the user won't be redirected. The problem does not exist for Mozilla based browsers because I think Mozilla wipes the buffer regardless of the value in content-length. :P Maybe that's why Mozilla is so slow.... And now, maybe Macromedia will fix this bug since it is easily reproducible. ---------------------------- James Ang Programmer MedSeek, Inc. [EMAIL PROTECTED] -----Original Message----- From: Gyrus [mailto:[EMAIL PROTECTED]] Sent: Monday, October 14, 2002 9:55 AM To: CF-Talk Subject: CFHTMLHEAD and appearance of HTTP header code in page Can someone help?! I'm *sure* this topic was just discussed here, but I can't find it on the list archives... Basically, I'm getting some broken bits of code at the top of a certain page, a mangled JS script and some of the HTTP header, like this: Script" type="text/javascript"> [ ... full JS script ... ] </script> HTTP/1.1 200 OK Server: Microsoft-IIS/4.0 Date: Mon, 14 Oct 2002 16:42:38 GMT Connection: close Content-type: text/html *Then* the page code proper starts, with <html> and so on. The JS code that gets mangled and inserted at the top of the page is inserted with CFHTMLHEAD, and does actually appear further down in its proper place. It works fine on my local CFMX, the live server is CF4.0, though... Can anyone point out that obvious little thing that's probably just been pointed out on the list that'll fix the problem?! TIA, Gyrus [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://www.norlonto.net PGP key available ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm

