Sunday, July 29, 2007


One thing caught my attention today about the use of XHTML. The standard says that these kind of web pages should be sent with a MIME type set to application/xhtml+xml but today most web programmers send it with the normal html mime type of text/html. This you can see by looking at the source of the web pages and in its header there is usually something like the following code (this one is from

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" xml:lang="en" lang="en"
<meta equiv="Content-Type" content="text/html; charset=utf-8">

This says that the document is an XHTML type document but it is sent as a text/html instead of application/xhtml+xml and according to this discussion can even be harmful to send it like that. So what is it that happens when a browser views a XHTML document sent as a text/html? Well, it basically treats the document as a normal html instead of XHTML so the troubles that the programmers have gone through to make the document XHTML complient were all in vein and all the XHTML advantages cant be used.

Why is it important? An example is this text. The Safari browser supposedly (I dont have a MAC so I cant test this) cant display this simple text because it contains XHTML code in it and Safari trying to be more clever than it is says that this is an XHTML document (which it isnt, it is just plain text) and then it sees code there that is not XHTML and like it is supposed to do, it doesnt display this page (if a browser gets code that it thinks is XHTML and it doesnt understand it then it is supposed to not display the page).

Another thing is that Internet Explorer doesnt know what to do with application/xhtml+xml. The product of one of the richest company in the world doesnt know what to do with a simple mime type, what are they using all their man power for? Ohhh yes ... now I remember, law suits! :-)

I think the main point of this rant here is that I think web developers should not start using XHTML at the moment, I dont think the browsers are ready for it.

No comments: