PROBLEMS SERVING XHTML 1.0 WEB PAGES

This is an XHTML 1.0 (Strict) Web Page served via content-negotiation (PHP on the Server side) as Media (MIME) type application/xhtml+xml (RFC3236) with XML declaration to Browsers that recognize that MIME type and as Media (MIME) type text/html (RFC2854) without XML prolog declaration to Microsoft Internet Explorer Browsers.

Producing XHTML 1.0 Web Pages:

There are numerous problems and pitfalls involved in producing XHTML 1.0 Web Pages - particularly those intended to comply with Appendix C of the W3C XHTML 1.0 Recommendation which are therefor really HTML rather than XHTML Web Pages. Practically all extant XHTML 1.0 pages are being produced in this manner. XHTML 1.0 Web Pages should really provide XML functionality as prescibed by the Recommendation. W3C XHTML 1.0 Recommendation (Second Edition) includes the syntax, constructs and guidelines.

Important considerations for Web Authors:

Web Authors wishing to produce optimally performing and conforming XHTML 1.0 Web Pages should consult the following References and Resources before they embark on actual page production:

Serving XHTML 1.0 Web Pages as Media type application/xhtml+xml:

XHTML 1.0 Web Pages should be served as Media type application/xhtml+xml to have XML functionality as prescibed by the Recommendation. The W3C Document XHTML Media Types - Second Edition: Serving the Most Appropriate Content to Multiple User Agents from a Single Document Source - W3C Working Group Note 16 January 2009 (work in progress draft document) provides suggestions and guidance relating to the delivering of XHTML Documents. However, as the Note points out it, is not intended to be a normative specification. Web Service Provider software often does not recognize the Media type application/xhtml+xml. In that case the Web Author will have to contact his or her Provider to try and convince them to adopt it as the Media type to associate with XHTML Web Pages. If that doesn't work -- and it may not -- then the Web Author will be faced with the task of producing and loading up to the server a .htaccess file that provides the association. Media types can also be established via server side scripting.

Note that content-type specified in Meta tags is only advisory - it does not affect the way the content is actually served.

Guide to .htaccess

Current XHTML/XML compliant browsers such as Firefox, Mozilla, Opera, Safari, et al. will retrieve and render XHTML Web Pages served as Media type application/xhtml+xml as intended - with full XML functionality.

Test/Demonstration page XHTML 1.0 (strict) Markup served with content (MIME) type application/xhtml+xml

Serving XHTML 1.0 Web Pages as Media type text/html:

Appendix C of the XHTML 1.0 Recommendation (HTML Compatibility Guidelines) provides information for Web authors who wish to produce XHTML Web Pages that will render in HTML specific user agents. Such Web Pages must be served as Media type text/html -- which are HTML rather than XHTML pages. Again, W3C XHTML Media Types Note, 16 January 2009 provides suggestions and guidance relating to the use of text/html but is not intended to be a normative specification. Practically all Web Pages with .htm or .html extensions are being automatically served as text/html which is the default Media type for most Web Service Provider software.

Problems related to MSIE Browser rendering of XHTML Web Pages:

MSIE Browsers will not retrieve and render XHTML served as Media type application/xhtml+xml correctly. MSIE 6.0 release 2900 and 7.0 will display such pages alright but will not render xml content. MSIE 6.0 release 2800 and earlier Browsers present a download screen -- selecting OPEN displays a plain, text only page (sans style sheet) and again will not render xml. IE6 Browsers render pages headed by the XML prolog in Quirks mode - IE7 Browsers will skip the prolog and render in Strict mode.

Microsoft's stated rationale for not recognizing XHTML Web Pages served with Media type application/xhtml+xml is set forth at:

Microsoft MSIE 7.0 Blog

This is a dilemma for web authors and the W3C which has attempted to resolve this situation by embracing Content Negotiation -- usually via PHP on the server side as has been done with this page -- in order to offer a choice of Media type text/html or application/xhtml+xml XHTML Web Pages to browsers so that they can render them according to their capabilities -- thus only XML compliant browsers will be served fully functional XHTML Web Pages.

Checking how pages are being served:

The Web-Sniffer HTTP Request & Response Header Viewer can be employed to check how any Web Page is being served to various Browsers (specified via User Agent window). Following are depictions of how this page is being served to a representative selection of typical Graphical Browsers:

XML compliant XHTML Checking tool (XML based rather than SGML based):

Validation results for this page:

SGML Markup Validation | XML Schema Validation | CSS Validation


Web Page Writer's Tool Kit