xhtml-1.1

The specification for xhtml-1.1 says that the server *should* send application/xml+xhtml in the HTTP header but that it *can* send text/html in order to remain backwards compatible with older user agents, IE for example. As long as the doctype is set correctly (and it is) it is still valid xhtml-1.1.

In fact, if you use the validator and let it auto detect the doctype it correctly detects xhtml-1.1 and validates the page using that specification (ignore the errors, I’m still workin’ on it). Browsers will also detect it, including IE, and use the correct specs to render the page. They also render the page in Standards Compliance Mode, including IE.

Trust me on this, I researched it *extensively* before making the jump to xhtml-1.1, I didn’t just blindly decide to change. I read the entire xhmtl-1.1 specification. I didn’t just skim it or skip any parts I read the entire thing. I read the XSLT-1.0 specification to make sure I was doing it right in the xsl. I also read TONS of threads from all over the world discussing this, including from IE support sites, apache, mozilla, w3c and web designer sites.

MS officially suggests using text/html in the HTTP header when serving xhtml-1.1 documents to IE. Mozilla, Opera, Firefox, Konqueror can all correctly use application/xml+xhtml and officially suggest that is what you send in the HTTP header but **ALL** of them are also backwards compatible with text/html.

None of the text browsers, as far as I know, can use application/xml+xhtml yet but, just like IE, they can correctly render an xhtml-1.1 page validly and in Standards Compliance Mode with text/html in the HTTP header.

So, to sum it up:

The site is validly serving XHTML-1.1 (except for the errors I haven’t fixed yet) that is recognized by all browsers and correctly rendered. The server doesn’t have to send application/xml+xhtml in the HTTP header in order for it to be valid, it can send text/html too.

5 thoughts on “xhtml-1.1”

  1. I sometimes use this bit of code to detect whether the browser can do application/xhtml+xml, so that IE can still have text/html and the others can have the real one:

    That’s, of course, php. You can probably translate it to your language of choice.

  2. So I guess this site doesn’t like tags… here’s just the code:

    if (strpos($_SERVER[HTTP_ACCEPT], “application/xhtml+xml”))
    header(“Content-type: application/xhtml+xml”);
    else
    header(“Content-type: text/html”);

  3. Where in the XHTML 1.1 spec does it say text/html is okay? I checked every page of it, and unless Firefox’s Find is broken, there’s no mention of text/html whatsoever, on any page. XHTML 1.0 does say you can send it as text/html, but even then, it’s not as broad as to say any valid XHTML 1.0 can be sent as such. And this states XHTML 1.1 should not be sent as text/html. If you have something to contradict this, please share.

  4. To check if the document is treated as xml (which is the purpose of application/xhtml+xml) just type a markup error e.g. <br> instead of <br /> and it must then correctly refuse to display ANYTHING other than a parse error. HTML is fault tolerant, XML isnt. XML and thus *real* XHTML *must* be well formed.

  5. Are you sure about this, Curtis? Serving XHTML 1.1 (modularized XHTML) as “text/html” breaks compliance with W3C’s standards. According to their site[1], only HTML4-compatible XHTML 1.0 is allowed ot be served as “text/html,” and only when required for backward compatibility reasons for non-compliant user agents.

    [1] http://www.w3.org/TR/xhtml-media-types/

Comments are closed.