Skip to main content
April 12, 2006
Answered

CFCACHE and DOCTYPE Issues

  • April 12, 2006
  • 3 replies
  • 1297 views

When a page is succefully cached coldfusion returns the cached html with a comment line occupying the first line. If the doctype isn't the first thing IE finds in the document it displays the page in Quirks mode, which makes it nearly impossible to use CSS consistantly between browsers.

Does anyone have a solution/work around to this caching issue? Running MX 7 on windows 2k3.
This topic has been closed for replies.
Correct answer BKBK
Apparently, what you're seeing is a well-known Internet Explorer bug. If anything appears before the doctype declaration, IE6 reverts to Quirk's mode. Do you do the caching with the cfcache tag? Couldn't you add some Javascript to hide the offending comment line?


3 replies

BKBK
Community Expert
Community Expert
April 23, 2006
I see from the topic's title that you likely use the cfcache tag. Then one can assume that the tag occurs in an ordinary CFM page, the one to be cached. Since Application.cfm or Application.cfc runs before the page, the problem might be solved by outputting the string

'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" " http://www.w3.org/TR/html4/strict.dtd">'

within Application.cfm or Application.cfc.


April 24, 2006

Same behavior... using application.cfc / cfm

Something i did notice. Is it either doesn't cache or doesn't put the comment when you load up the server from localhost or 127.0.0.1.

Thanks for looking into this. I did try some javescripting, but by the time you can run a script IE has already decided to process the page in quirks mode. I didn't find a way to reverse it.

BKBK
Community Expert
Community Expert
April 25, 2006
We cannot do anything about IE6 reverting to quirksmode when there is a comment line before the doctype declaration. That's just an IE browser bug.

I'll continue to look. However, the only solution I see, so far, is for the Coldfusion team to update the cfcache tag to prevent it from putting the comment line there in the first place. What you can do, as developer, is to file a bug report and wait in hope.


BKBK
Community Expert
BKBKCommunity ExpertCorrect answer
Community Expert
April 13, 2006
Apparently, what you're seeing is a well-known Internet Explorer bug. If anything appears before the doctype declaration, IE6 reverts to Quirk's mode. Do you do the caching with the cfcache tag? Couldn't you add some Javascript to hide the offending comment line?


BKBK
Community Expert
Community Expert
April 13, 2006
A Coldfusion comment ( <!---c---> ) or an HTML comment ( <!--c--> )? I don't expect problems from either.




April 13, 2006
Yes you wouldn't expect a problem from either yet there still is one:

The page returned without caching:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" " http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
....

The page returned after successful cache:
<!--- http://servername/index.cfm--->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" " http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
...

Looks and works fine in firefox. Didn't check other browsers but i would expect the compliance based ones will work.
IE doesn't find the doctype and displays in quirks mode.