Your script will serve application/xhtml+xml to a browser with an Accept
header of "text/html,application/xhtml+xml;q=0.1', which is completely
broken behavior. Opera, one example of a browser with such an Accept
header, will fail to handle HTML entity references in
application/xhtml+xml documents.
There is no problem with recent versions of Opera, Mozilla, Netscape,
Firefox, IE6, MyIE2, MSN9, and another two more obscure browsers for
which I have been sent screen shops. I test my many pages served in
this way on all of the mentioned browsers. If Opera or any other
browser lies that it will accept application/xhtml+xml, that is
apparently no problem in rendering the page. Opera does accept the page
as xhtml 1.1 as you can see by viewing the source code while on Opera,
or it will accept a page without a php include that has the extension
..xhtml which is assigned to the mime type application/xhtml_xml on the
server. On contrast IE6 accepts the html 4.01 strict code as you can
see when viewing on IE6. If you try to force the mentioned page without
a php include and with the extension .xhtml, the page is not displayed
at all on IE6. Now it would be no surprise to me if Opera lies, because
it can lie about what browser it is in the navigator.appName and call
itself IE6, etc. However, even if it claims it accepts
application.xhtml+xml in header information and then processes as
text/html instead, it has built in changes to process the true xhtml
code you deliver properly in so far as rendering the page is concerned.
Of course all of this has no bearing on my answer to the question,
because you can just as well serve a page as html 4.01 strict only with
only the php server script to validate input.
So you're punishing your visitors, many of whom may have no choice in
browser, for Microsoft's behavior? If I were forced to use IE (like I
was for a month last year) and received an annoying popup every time I
viewed a page on your site, you would lose a visitor.
You failed to complete quoting my discussion on this issue, which
concluded:
How to remove this alert is shown in the source
code, as you would not want this on a commercial site that wants to
sell something.
I do not use this alert on my many general web pages, since even I get
tired of looking at it when checking pages on IE6. I use it only on
pages that mention the IE6 problem to underline the problem. However,
there always is a comment in the source code when html 4.01 strict is
delivered rather than xhtml 1.1.
Of course one is free to use any level of xhtml/html they wish. So far
as I know, html 3.2 still works on current browsers and can be made to
validate as such at the W3C. Of course you could not use style sheets
in html 3.2, since CSS only came in as part of html 4. For me the time
has come to switch most new pages to true xhtml 1.1. There are several
other considerations, especially concerning javascript, that must be
considered as well as what was mentioned here. After all xhtml 1.1 has
been around quite a while now and the W3C has a newer version of xhtml
in the works. This new version will require new browsers, however.