Hi,
This does work if you use PHP to provide the correct alternative instead of
just changing the MIME-type. Since XHTML 1.1 should NOT be served as
text/html, this is the code I use on my site:
<? $isXHTML11 = "";
if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
$isXHTML11 = 1;
header ("Content-Type: application/xhtml+xml;
charset=UTF-8");
echo ('<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">');
} else {
$isXHTML11 = 0;
header ("Content-Type: text/html; charset=UTF-8");
echo ('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
} ?>
Then further down in the head section I have:
<? if($isXHTML11 == 0) {
echo (' <meta http-equiv="content-type" content="text/html;
charset=UTF-8" />');
} ?>
What this does is check if the user's browser can accept the
application/xhtml+xml MIME-type. If it does, the page is sent with a full
XML declaration and XHTML 1.1 doctype. If not, an XHTML 1.0 doctype is
inserted and further down the content-type meta tag is inserted. The W3C
say that XHTML may be served as text/html so I think this covers all bases:
namely XML ready browsers and non-XML ready.
Thanks
P.S. I am a PHP noob so please excuse my code if it is inefficient. It
works. :)
------------------
Iain Gardiner
http://www.firelightning.com
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Alan Milnes
Sent: 09 June 2004 12:45
To: [EMAIL PROTECTED]
Subject: Re: [WSG] meta http-equiv
> The correct content type or MIME type for an XHTML document is
> "application/xhtml+xml". Although I might add internet explorer
> doesn't understand it so you need to determine if the users browser
> accepts it.You can do this in PHP by
> writing:
::::: SNIP:::::
The suggested method doesn't work when you go to validate your pages, see
the discussion at:
http://www.xml.com/pub/a/2003/03/19/dive-into-xml.html
Alan
*****************************************************
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
*****************************************************
*****************************************************
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
*****************************************************