Re: Validator doesn't send HTTP_ACCEPT headers, "Conflict between Mime Type and Document Type" warning is incorrect.

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