XML.com: XML From the Inside Out

XML.comWebServices.XML.comO'Reilly Networkoreilly.com
  Articles | Weblogs | Newsletter | Safari Bookshelf
advertisement

Article:
 The Road to XHTML 2.0: MIME Types
Subject: Stupid Fix
Date: 2006-03-13 07:28:57
From: vickery

I can test if a page is being validated by the W3C, and alter the MIME type accordingly (see below; pardon the line breaks). But that's stupid.


I infer, however, that there is no other way to get the validator to see the web page as application/xhtml+xml and not break the page in ie6. Am I missing something?


<?php
if ((isset($_SERVER["HTTP_ACCEPT"]) and
stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) or
stristr($_SERVER["HTTP_USER_AGENT"], "W3C_Validator") )
{
header("Content-type: application/xhtml+xml");
print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
}
else
{
header("Content-type: text/html; charset=utf-8");
}
?>



Previous Message Previous Message   Next Message Next Message

Sponsored By:


Contact Us | Our Mission | Privacy Policy | Advertise With Us | | Submissions Guidelines
Copyright © 2008 O'Reilly Media, Inc. | (707) 827-7000 / (800) 998-9938