send your xhtml as application/xhtml+xml

16th Dec 2004

If you use PHP to serve your web pages, then here is the code snippet to use for determining if a user's browser is xhtml compliant.

if ( isset($_SERVER["HTTP_ACCEPT"]) and stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
header("Content-type: application/xhtml+xml");
}
else {
header("Content-type: text/html");
}

At present only GECKO browsers can serve xhtml as xml.