[thelist] xhtml vs html

Kristof Neirynck k.neirynck at belgacom.net
Wed Jul 23 07:13:19 CDT 2003


> I found myself in the same boat you did not too long ago. The obvious answer
> would have been to send my xhtml files as application/xml+xhtml as they should
> be, but that kills IE. Of course, if your xhtml files meet the html
> compatibility guidelines, you don't really have to worry. I found this kind of
> restrictive though, and kind of a cheap trick to keep IE happy. Ultimately, my
> solution was to adhere to ISO html rather than xhtml strict, which works
> wonderfully and allows me to sleep at night as well.

I've hit my head against the wall 20 times or so and when the bleeding 
stopped I wrote this in php:

$contentType=eregi('application/xhtml\+xml',$_SERVER['HTTP_ACCEPT'])?'application/xhtml+xml':
(eregi('application/xml',$_SERVER['HTTP_ACCEPT'])?'application/xml':
(eregi('text/xml',$_SERVER['HTTP_ACCEPT'])?'text/xml':
'text/html'));
header('Content-Type: '.$contentType.'; charset=iso-8859-1');

I think something like this can be done in ".htaccess".
Don't know how thow.


Kristof



More information about the thelist mailing list