
At Tue, 8 Jul 2008 00:55:31 +0200, Jesús Guerrero wrote:
As an example, you can check this site I am designing (it's a basic template and something experimental, but it's just an example). The relevant pieces of my xhtml files are these:
====================== <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es"> <div id='header'>
<head> <meta http-equiv='content-type' content='application/xhtml+xml;charset=utf-8' /> =======================
Hello, When I say that XHTML is not supported by IE, I specifically mean, if you serve XHTML with the Content-Type: application/xhtml+xml, it will be completely unviewable in any version of IE. (It turns out that these days, konqueror, lynx, opera, safari, and firefox all work fine, so only IE is busted). [Note: I hope you find the rest of this message informative and helpful. Reading it over, I think it sounds a bit like an attack -- which it is not supposed to be. So, be sure to read it in a happy, pleasant, and helpful tone. And, also, I could be wrong about some of this stuff -- it is hard to fine accurate information on the net about it.] The reason your sites work is because you are using the Content-Type text/html, and the browsers are doing their darnest to figure out how to render the code using their HTML engines. While the internals of your html documents all say "I'm xhtml", the web server says, "treat this document as text/html". Using curl we see that the web server sets the Content-Type to text/html not application/xml+xhtml: stepcut@lain:/tmp$ curl -D - http://jesgue.homelinux.org/yobonobo/ | head % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1183 0 1183 0 0 1068 0 --:--:-- 0:00:01 --:--:-- 1068HTTP/1.1 200 OK Transfer-Encoding: chunked X-Powered-By: PHP/5.2.6RC4-pl0-gentoo X-Pingback: http://jesgue.homelinux.org/yobonobo/wordpress/xmlrpc.php Content-Type: text/html; charset=UTF-8 Date: Tue, 08 Jul 2008 00:36:54 GMT Server: lighttpd/1.4.19 According to the w3c, you *should not* serve XHTML 1.1 Strict with the text/html http header: http://www.w3.org/TR/2002/NOTE-xhtml-media-types-20020801/#summary So, at the very least, you are not following recommendend standards practices. Additionally, your homepage fails to validate: http://validator.w3.org/check?uri=http%3A%2F%2Fjesgue.homelinux.org%2Fyobonobo%2F&charset=(detect+automatically)&doctype=Inline&group=0 Which means if it were actually being treated as application/xml+xhtml, it would not be rendered at all by a firefox, etc, because they are *required* to show an error *instead* of the page if *any* validation errors occur. Additionally, if you open your page in firefox and go to 'Tool -> Page Info', it says under 'Type' 'text/html'. And, if you were to add: <script>alert(document.contentType);</script> to your page, I bet it would say 'text/html'. This means your page is *not* valid xhtml and it is also *not* valid HTML. The *only* reason it renders is because the page is being treated as very broken html, and the browsers are doing their best to make it look good. As far as I know, the *only* way to get firefox (and other browsers) to treat xhtml as xhtml is to have the HTTP Content-Type header say, "application/xml+xhtml". There is absolutely nothing you can put *in* the xhtml document that will override what the server puts in the HTTP headers. If you have a reference that shows otherwise, let me know. But, the tests I described in this email seem to indicate that firefox is treating your page like xhtml, not html. If you were to configure your server to properly serve as application/xhtml+xml, then IE users would not be able to view the page. So, they question is, what benefit are you hoping to get by serving (invalid) xhtml as text/html? If you are serving it as text/html, that means you can only use the features available in regular HTML 4.01. Additionally, you can't even parse it using a regular XML parser, because it is not valid. My claim is mostly that there are none or very few useful benefits to serving xhtml as text/html. Additionally, looking towards the future, it is my *opinion* that HTML 5 is going to be the future, not xhtml. So, why not serve plain-old HTML 4.01 now ? It seems quite unlikely that you will ever being swiching your server to serving application/xhtml+xml, so it is not like you are going to be ready for the day when that happens? And, finally, in practice, I don't think it makes a big difference, which is why I am relatively content to let people serve xhtml as text/html on xmonad.org. j. http://webkit.org/blog/68/understanding-html-xml-and-xhtml/