Is sending XHTML as text/html harmful?

All style (template, theme and imageset) related questions for the new release; advice, feedback here please.
markus_petrux
Registered User
Posts: 376
Joined: Fri Jun 18, 2004 10:58 pm
Location: Girona, Catalunya (Spain)
Contact:

Is sending XHTML as text/html harmful?

Post by markus_petrux »

I have just found this:
http://www.hixie.ch/advocacy/xhtml" target="_blank

Quoting:
Abstract

A number of problems resulting from the use of the text/html MIME type in conjunction with XHTML content are discussed. It is suggested that XHTML delivered as text/html is broken and XHTML delivered as text/xml is risky, so authors intending their work for public consumption should stick to HTML 4.01, and authors who wish to use XHTML should deliver their markup as application/xhtml+xml.
Context

This was originally written in September 2002 in the context of this Web log entry:

http://ln.hixie.ch/?start=1031465247&count=1" target="_blank

It has since been regularly updated to correct errors that have been brought up in various mailing lists and other discussion forums. As of late 2004, it is still just as relevant as when it was originally written.

Note that this document compares XHTML 1.0 compliant to appendix C to HTML 4.01, because that is the only variant of XHTML that may be sent as text/html.
Sorry, if that's widely known. :? I just found pretty interesting.


EDIT: I forgot to post a little question I had in mind?

Having read that article, it looks like IE6 (and of course other legacy browsers) doesn't support XHTML Strict. Does that mean it is required to somehow "detect" the browser prior to sending the headers (mimetype application/xhtml+xml and the xhtml doctype)?

User avatar
Viperal2
Registered User
Posts: 223
Joined: Tue Jun 08, 2004 9:28 pm
Contact:

Re: Is sending XHTML as text/html harmful?

Post by Viperal2 »

That article is so old. Sending a Content-Type header text/html is currently what's recommended for XHTML, for compatiblity. I'm never done a XHTML Strict doc ( nore HTML strict ), but I'm sure IE supports it, your limitation would be IE's CSS support.

That articles I like 3years old, and totaly inaccurate for current browsers. You can program with XHTML almost freely, when it come to CSS cross compatiblly ( or lack of in IE ) and the way they handle some tags, that's where you'll be having problems. But that only minor stuff that are easily bypasses.
What is The Viperal ?

http://developer.berlios.de/projects/viperals/" target="_blank

markus_petrux
Registered User
Posts: 376
Joined: Fri Jun 18, 2004 10:58 pm
Location: Girona, Catalunya (Spain)
Contact:

Re: Is sending XHTML as text/html harmful?

Post by markus_petrux »

Viperal2 wrote: That articles I like 3years old, ...
Not completely exact, to quote that doc:
It has since been regularly updated to correct errors that have been brought up in various mailing lists and other discussion forums. As of late 2004, it is still just as relevant as when it was originally written.
Viperal2 wrote: I'm never done a XHTML Strict doc ( nore HTML strict ), but I'm sure IE supports it, your limitation would be IE's CSS support.
I should say I do not have much experience with XHTML Strict (that's why I opened this thread), but it seems to be true what the conclusion of that doc states. Have you tried to visit http://www.mozillaquestquest.com/" target="_blank ?
Conclusion
----------

There are few advantages to using XHTML if you are sending the content as text/html, and many disadvantages.

In addition, currently, the majority (over 90% by most counts) of the UA market is unable to correctly render real XHTML content sent as text/xml (or other XML MIME types). For example, point IE at:

http://www.mozillaquestquest.com/" target="_blank

Only Mozilla, Mozilla-based browsers such as Netscape 6 and 7, recent versions of Opera, and Safari, are able to correctly render that site. (IE6 shows a DOM tree!)

Authors who are not willing to use one of the XML MIME types should stick to writing valid HTML 4.01 for the time being. Once user agents that support XML and XHTML sent as one of the XML MIME types are widespread, then authors may reconsider learning and using XHTML.

(Advanced authors should also see appendix B.)
Viperal2 wrote: ...Sending a Content-Type header text/html is currently what's recommended for XHTML, for compatiblity.
Recommended? Could you please elaborate? ...a link?

User avatar
smithy_dll
Registered User
Posts: 461
Joined: Tue Jan 08, 2002 6:27 am
Location: Australia
Contact:

Re: Is sending XHTML as text/html harmful?

Post by smithy_dll »

Read the IE blog, IE doesn't accept a application/xhtml+xml MIME type, so you have to send as text/html. They even stated that this will not be fixed in IE7.
Image
phpBB, its open source, become involved, write a modification!
Modifications Database | MOD Development Forum Rules | MOD Studio

User avatar
Viperal2
Registered User
Posts: 223
Joined: Tue Jun 08, 2004 9:28 pm
Contact:

Re: Is sending XHTML as text/html harmful?

Post by Viperal2 »

markus_petrux wrote:
Viperal2 wrote: I'm never done a XHTML Strict doc ( nore HTML strict ), but I'm sure IE supports it, your limitation would be IE's CSS support.
I should say I do not have much experience with XHTML Strict (that's why I opened this thread), but it seems to be true what the conclusion of that doc states. Have you tried to visit http://www.mozillaquestquest.com/" target="_blank ?
Appearently you haven't seem many XHTML strict sites, but I can say they do exsist and work perfectly fine. Also that document is on all XHTML markup.

But the document is right, on that application/xhtml+xml and text/html doesn't parge XHTML docs the same. But I wouldn't call it harmfull nor that you shouldn't code in XHTML.

application/xhtml+xml treats XHTML docs just like other xml docs, so it wouldn't parge something with errors. So if you missed an end tag, then it doesn't display. I'm sure everyone knows in XHTML tags and namespaces are lowercase, with was one of the main differenced with XHTML. Those are nothing a good validator wouldn't fix.

the only valid thing I see is document.write(), with they say don't work with application/xhtml+xml. Just, bacause text/HTML doesn't stop your page from displaying when your code isn't totally XHML and XTHML valid doesn't mean it's harmfull. It's up to the programmer to make sure there code is XHTML, although with application/xhtml+xml it has to.

So, I'll ask you this. Does that mean I should stop programming in XHTML because my document will display, if not perfically, when it not XHTML valid with the text/html header ?
What is The Viperal ?

http://developer.berlios.de/projects/viperals/" target="_blank

markus_petrux
Registered User
Posts: 376
Joined: Fri Jun 18, 2004 10:58 pm
Location: Girona, Catalunya (Spain)
Contact:

Re: Is sending XHTML as text/html harmful?

Post by markus_petrux »

No, no, well, I'm just trying to understand. I guess many questions are answred in the W3C note about XHTML media types.

There seem to be two different things here:
1) Generate valid XHTML Strict, even if it is sent as text/html (processed by a HTML parser? ).
2) Trigger the XML parser of the UA, which depends on the mime type of the document?

So, while 1 seems to be important, what happens with 2? ...if one wants to trigger the XML parser, the mime type 'application/xhtml+xml' should be used, but that's not supported by IE (and other legacy browsers), right?

User avatar
smithy_dll
Registered User
Posts: 461
Joined: Tue Jan 08, 2002 6:27 am
Location: Australia
Contact:

Re: Is sending XHTML as text/html harmful?

Post by smithy_dll »

Thats correct, in that it's not supported by IE. Alot of sites however detect the browser and send ffx the correct mime, and give everyone else text/html.

XHTML1.0 can be sent using text/html, however XHTML1.1 must be sent using application/html+xml
Image
phpBB, its open source, become involved, write a modification!
Modifications Database | MOD Development Forum Rules | MOD Studio

link92
Registered User
Posts: 46
Joined: Sat Mar 27, 2004 2:43 pm
Location: In front of my Computer
Contact:

Re: Is sending XHTML as text/html harmful?

Post by link92 »

Davidls wrote: XHTML1.0 can be sent using text/html, however XHTML1.1 must be sent using application/html+xml
XHTML 1.1 can be sent as text/html, but it should not.

Here's a quote from the W3 Mailing List:
Steven Pemberton wrote: David,

The HTML WG has discussed this issue: the intention was to allow old (HTML-only) browsers to accept XHTML 1.0 documents by following the guidelines, and serving them as text/html. Therefore, documents served as text/html should be treated as HTML and not as XHTML. There should be no sniffing of text/html documents to see if they are really XHTML.

Note that there are some semantic differences between HTML documents and XHTML documents: there are specific CSS rules that only apply to HTML (and not XHTML), and the DOM has different effects (for instance, the element names are returned in uppercase for HTML, and lower case for XHTML).

Best wishes,

Steven Pemberton
Chair, W3C HTML WG
Bored as hell. May as well put myself through the (X)HTML validator to see how invalid I am.

scorpiotiger
Registered User
Posts: 1
Joined: Tue Mar 20, 2007 6:36 pm

Re: Is sending XHTML as text/html harmful?

Post by scorpiotiger »

more on this topic:

IE7 support of xhtml

Activating the Right Layout Mode Using the Doctype Declaration

scroll to the Doctype Table. Browsers on top, Doctype on the left column. S=Standards Mode. A=Almost Standards Mode
look at XHTML 1.0 Transitional , vs HTML 4.01 Strict.

Why most of us should NOT use XHTML

and a new w3 group to work on the next version of HTML has started:
http://www.w3.org/html/
http://www.w3.org/html/wg/


(and this is the link previously posted)
http://hixie.ch/advocacy/xhtml

link92
Registered User
Posts: 46
Joined: Sat Mar 27, 2004 2:43 pm
Location: In front of my Computer
Contact:

Re: Is sending XHTML as text/html harmful?

Post by link92 »

Let me ask this one question: what advantages are there to sending XHTML as text/html over HTML as text/html?
Bored as hell. May as well put myself through the (X)HTML validator to see how invalid I am.

Post Reply