IE9 beta finally seems to support xhtml properly

C

cwdjrxyz

Most modern browsers have been able to handle xhtml properly served as
application/xhtml+xml for years, but no IE browser until the new IE9
beta has been able to show a true xhtml page correctly.
There has been much confusion about xhtml. Xhtml handles html, xml, or
a mixture of both. The rules for xml are much more strict than for
html, so an xhtml page must be parsed as xml, not html.
The extension .html assigned to mime type text/html on the server is
for html pages only. Thus one must associate another extension with
the mime type application/xhtml+xml for serving xhtml for an xhtml
page.
Even if you have a page that validates as some version of xhtml, it
will not be served correctly if you use the extension .html. I have
some demo pages that hopefully will make this situation more clear.

The example pages have a logo for the w3c validator to the bottom left
of the page. You click this logo to validate the page. Then under
Options check Show Source, check Verbose Output,and click Revalidate.
IF the code is valid, you will get "This document was successfully
fully checked as XHTML 1.1" or you will get red and error messages.
This only tells you that the page has valid code, not if it is served
properly. Next find "Content Type". If content type is text/html the
page is being served as html. If the content type is application/xhtml
+xml the page is being served as xhtml.

Now view http://www.cwdjr.net/flash/Fatty.php . A server side php
script, which can not be viewed, at the very top of the page is used
for header exchange between the server and client computer browser
before the page is downloaded. the server asks the browser if it can
accept application/xhtml+xml. If so, the page is downloaded as
written. If the browser tells the server it can not use application/
xhtml+xmnl then some fairly complicated php script including regular
expressions is used to rewrite the page as html4.01 strict and then
download it to the browser. If you check the source code for this page
after it downloads, you thus find it is written in xhtml for most
modern browsers and as html 4.01 strict mainly for IE browsers through
IE8 which can not properly show any version of xhtml served properly.

Now view http://www.cwdjr.net/flash/FattyX.xhtml . This is an xhtml
page only with no fancy header exchange to convert to html if needed.
I think you will be able to view this properly on IE with IE9 beta
only and of course most other modern browsers.

Now, if you can view the xhtml page given just above, view
http://www.cwdjr.net/flash/FattyXE.xhtml . This page has the single
error of using <br> instead of <br /> near the top of this page. The
page may not show at all or display only down to the error, or you may
get an error report from the xml parser. This differs a bit on
different browsers. On IE9 beta, click F12 for details.

Next view http://www.cwdjr.net/flash/FattySE.html . Here the valid
xhtml 1.1 page is served as html instead of xhtml. See the validator
link to comfirm this and you will find the content type is just text/
html. The page likely will work on older IE browsers since mis-serving
as html kicks in the html parser rather than the much more strict xml
parser. I would guess that over 90% of pages claiming to be xhtml are
just this type of mis-served page.The page would have been better
written with less effort by using html 4.01 strict in the first place,
as the xhtml page can not be properly parsed with the html parser.

Last view http://www.cwdjr.net/flash/FattySEE.html . This is the above
xhtml page mis-served as html with the mentioned <br> error. Despite
an error it will view well on a desktop because the html parser is not
nearly as strict as the xml parser. However xml errors will be let
through. If the page contained any xml code, and especially for small
xml devices, the page might not work at all because everything in xml
must be closed.
 
E

Eric Bednarz

cwdjrxyz said:
Even if you have a page that validates as some version of xhtml, it
will not be served correctly if you use the extension .html.
^^^
*I* have no trouble at all serving whatever I want in response to *any*
request, thank you. :)
Now view http://www.cwdjr.net/flash/Fatty.php . […]
If the browser tells the server it can not use application/
xhtml+xmnl then some fairly complicated php script including regular
expressions is used to rewrite the page as html4.01 strict and then
download it to the browser.


Predictably, it doesn’t.


HEAD /flash/Fatty.php HTTP/1.1
Host: www.cwdjr.net
Accept: text/html, application/xhtml+xml; q=0
Connection: Close

HTTP/1.1 200 OK
Date: Fri, 24 Sep 2010 11:18:21 GMT
Server: Apache
Vary: Accept
X-Powered-By: PHP/5.2.12
Connection: close
Content-Type: application/xhtml+xml;charset=UTF-8


It’s beyond me why people who don’t understand HTTP feel this urge to
come up with their own hoemgrown content negotiation from hell.
 
B

Beauregard T. Shagnasty

cwdjrxyz said:
Most modern browsers have been able to handle xhtml properly served as
application/xhtml+xml for years, but no IE browser until the new IE9
beta has been able to show a true xhtml page correctly. ...

Thanks for the nice research, cwd. Any wagers on whether or not this
capability actually makes it into the final release of IE9? ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top