I want to use XHTML5 but apparently they two browsers don't accept the application/xhtml+xml
MIME type. I read that they will accept text/xml
(or application/xml
not sure) but it is kind of hackish. So I was wondering if I should just serve HTML5 to IE7 and IE8?
Please don't go on talking about XHTML vs HTML advantages. I know.
My split-the-difference recommendation:
<!doctype html>
and no<?xml ...?>
norxmlns
directives.Content-Type: text/html; charset=utf-8
. (Change the value of the charset parameter if you must, but PUT ONE IN, or you risk UTF-7 trickery.)You get the benefits of XML strictness on the server -- you'll notice if you're generating invalid markup, and it makes it much harder to get quoting wrong -- but you don't have to deal with figuring out which clients will actually honor XML mime types.
Note that you can directly embed SVG and MathML in HTML5 even when you're using the HTML5 serialization (the
<svg>
and<math>
elements are magic).XHTML 5 is not a standard. XHTML 2 does prescribe a new doctype, though XHTML 2 is not supported by any modern browsers (as it is largely unfinished).
HTML5Doctor recommends that if targeting an "XHTML5" approach, simply use the HTML5 doctype, which makes sense. The HTML5 doctype is compatible with IE7/8.
http://html5doctor.com/html-5-xml-xhtml-5/
Remember, to use HTML5 (properly) in IE <9, you need to include the HTML 5 shiv.
http://ejohn.org/blog/html5-shiv/
Also, in terms of a MIME type for XHTML5, you MUST serve the content with
application/xhtml+xml
orapplication/xml
, which older version of IE will NOT support. Thus, if you're trying to take a purist approach, you CANNOT have IE 6/7 support.It doesn't really matter so long as you:
Using the same Doctype throughout is generally a good idea.
Serving up as application/xhtml+xml to some browsers and the same content as text/html to other browsers is generally a waste of time and effort.