0

CFCACHE, IE, CSS and XHTML

CFCACHE, IE, CSS and XHTML via @largestartist Posted by Jose Cuadra on September 4, 2009 Tags: | | | | | | | Filed Under: References

Yesterday I experienced an unusual rendering issue in Internet Explorer. The entire layout was aligning left and a couple z-index declarations were being ignored. Usually you can fix the minor issues with some Conditional Comments but these inconsistencies were too great to blame on the Trident Layout Engine(MSHTML). Besides, before I added Coldfusion to the mix it rendered properly in every browser.

After painstakingly crawling over the final generated markup I found the only difference from the local version that worked perfectly was a comment implanted before the doc type declaration. Apparently placed there by Coldfusion. Running a global search for the commented string yielded no results which suggested to me that it had to be dynamically written or the result of some type of function where the string was not hard coded.

Problem

During some research I found that when having Coldfusions CFCACHE tag in play the application inserts a comment before any other markup. This throws Internet Explorer into “Quirks Mode” in IE 6 and 7 and “Standards Mode” in IE8 if using an XHTML Strict Doctype. Needless to say this ruins any CSS layout you may have created.

This has been a known issue for versions 6, 7 and 8 of Coldfusion(Supposedly fixed in release 8.0.1 even though some users are still getting the comment).

Solution

Obviously disabling CFCACHE would be ideal but if you did not have permission or access to do so the next fix should work.

Adding the below tag at the beginning of the document will force the content to be rendered as text/html abiding by the rules and eliminating the comment.

<cfcontent type="text/html">

Want More? Try These.

Related Articles
Live Markup Editor
IE Conditional Comments
Web Fonts Suck!
Random Functions
Flash Slideshow in Actionscript 3
Target Blank for XHTML
Table Behavior without Tables
Type Doc Re-Released
Access Cascading Styles with JavaScript
Random Articles
Flash Slideshow in Actionscript 3
Access Cascading Styles with JavaScript
JavaScriptless Tool Tips
Funny Superman Shirts
Color Picker
JavaScripted Tooltips
Web Fonts Suck!
Dreamweaver CS3 Start and Crash Bug
Classy Glassy Orbs
Font Fight!

Leave a Reply