Forum Moderators: open

Message Too Old, No Replies

XHTML displays XML source in IE 6

         

edisraf321

3:09 pm on Apr 6, 2004 (gmt 0)

10+ Year Member



I am building ColdFusion XHTML pages, but when I try to view the pages in IE 6, the XML source is displayed instead of the rendered HTML.

It works fine in FireFox, any suggestions?

Doctype is as follows:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

-Thanks,
Chris

DrDoc

3:22 pm on Apr 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you sending the page as application/xhtml+xml or text/html?

edisraf321

3:28 pm on Apr 6, 2004 (gmt 0)

10+ Year Member



I am not including an custom headers via ColdFusion, I have this in the head of the document.


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

pageoneresults

3:29 pm on Apr 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



No need for the charset metadata as you are declaring it in the XML prologue.

DrDoc, did I say that right? ;)

DrDoc

3:47 pm on Apr 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You sure said it right ;)
And, that is true as long as the server sends out a header specifying the content type for the page.

grahamstewart

4:16 pm on Apr 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try ditching the xml prologue - it causes IE6 to go into 'Quirks mode' anyway.

pageoneresults

4:20 pm on Apr 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Try ditching the xml prologue.

Can we talk about this a little bit? I just recently switched everything over on one site to using the XML Prologue as it is part of the specification. If it causes IE to go into quirks mode, will removing it still produce the desired results in browsers that it doesn't trigger quirks mode in?

grahamstewart

4:25 pm on Apr 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



w3c say:

With Internet Explorer, however, if anything appears before the DOCTYPE declaration the page is rendered in quirks mode. Because Internet Explorer users count for a very large proportion of browser users, this is a significant issue. If you want to ensure that your pages are rendered in the same way on all standards-compliant browsers, you need to think carefully about how you deal with this.

Here are the options. Obviously, if your document contains no constructs that are affected by the difference between standards vs. quirks mode this is a non-issue. If, on the other hand, that is not the case, you will have to add workarounds to your CSS to overcome the differences, or omit the XML declaration.

The XHTML specification also warns that "processing instructions are rendered on some user agents. Also, some user agents interpret the XML declaration to mean that the document is unrecognized XML rather than HTML, and therefore may not render the document as expected." You should do testing on appropriate user agents to decide whether this will be an issue for you.

Note that if you decide to omit the XML declaration you should choose either UTF-8 or UTF-16 as the encoding for the page. (See Character sets & encodings in XHTML, HTML and CSS for more information about the impact on encoding declarations.)
..........................
We assume that, because of its tendency to cause Internet Explorer to render in quirks mode, some people prefer not to use the XML declaration for XHTML served as text/html.

- from Character sets & encodings in XHTML, HTML and CSS [w3.org]

Good article - well worth a read.

edisraf321

4:28 pm on Apr 6, 2004 (gmt 0)

10+ Year Member



The prologue fixed it, so thanks.

I am interested to hear why this does this, because I thought the prologue was part of the XHTML spec. Is it just an IE thing?

edisraf321

4:41 pm on Apr 6, 2004 (gmt 0)

10+ Year Member



Great article. Thanks.