- From: olivier Thereaux <ot@w3.org>
- Date: Wed, 1 Aug 2007 10:04:43 +0900
- To: Gez Lemon <gez@juicystudio.com>
- Cc: www-validator Community <www-validator@w3.org>
On Aug 1, 2007, at 00:49 , Gez Lemon wrote: > You could first check that there is an HTTP_ACCEPT header. If not, > deliver application/xhtml+xml; otherwise, test if > application/xhtml+xml is in the accept header. That caters for all the > scenarios you mentioned. The following serves text/html to IE, > application/xhtml+xml to Firefox (and other browsers that state they > can handle it), and application/xhtml+xml to the validator (as it > doesn't send the accept header): > > header("Vary: Accept"); > if ($_SERVER[HTTP_ACCEPT]) { > if (stristr($_SERVER[HTTP_ACCEPT], "application/xhtml+xml") === > FALSE) { > header("Content-Type: text/html; charset=utf-8"); > } > else { > header("Content-Type: application/xhtml+xml; charset=utf-8"); > } > } > else { > header("Content-Type: application/xhtml+xml; charset=utf-8"); > } Looks good, Gez, do you think you could update http://juicystudio.com/article/content-negotiation.php#php accordingly? Thanks -- olivier
Received on Wednesday, 1 August 2007 01:04:21 UTC