2016-02-11

I'm taking away the link to this page from my main page. It's 17 years old, and... I don't feel so strongly about it anymore. Microsoft added support in IE 9, in March 2011.

Web Content

Intro
XML
Microsoft Compatibility
Standards Compliant Browsers
Browser Compliance Notification
Future Compatibility: HTML5

This page is validated HTML5/XML.


Intro

Nobody writes perfect html. Nobody wants to be the only one whose browser can't display some badly written html page. This results in a war over whose browser can accept the worst html. Which involves a lot of intensive processing, and the results are never consistent. There are solutions.

XML

XML must always be perfect, or it is not allowed to be considered XML, and not allowed to be rendered (displayed as a web page). So you can verify that an XML page is well-formed just by loading it in a web browser. Every page is always perfect. This is obviously a lot easier and faster for a browser to display. And always the same.

XHTML 1.0 was released in 2000, as a bridge between HTML and XML. Existing browsers could all process it as HTML if it was served with a "Content-Type: text/html" header, as html had always been. New browsers could take full advantage of XML parsing if it was served with a "Content-Type: application/xhtml+xml" header.

XHTML 1.1 was released in 2001, no longer HTML compatible, taking further advantage of being XML.

Microsoft Compatibility

Nine years later, Microsoft's browsers, if provided with an entirely valid page with a "Content-Type: application/xhtml+xml" header, will ask you if you want to download it. That's right, it doesn't even know what it is. All other browsers render it beautifully.

To support Microsoft, you should write XHTML 1.0, following the html compatibility guidelines, and configure your server to send "Content-Type: text/html" to Microsoft browsers, and "Content-Type: application/xhtml+xml" to all other browsers. Detailed Apache configuration instructions from IBM. Short version:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} .*MSIE.*
RewriteCond %{REQUEST_URI} \.xhtml$
RewriteRule .* - [T=text/html]

Standards Compliant Browsers

If you only wish to concern yourself with browsers who make an attempt at standards compliance, write in XHTML 1.1 and always serve it as "Content-Type: application/xhtml+xml". You may wish to redirect incompatible browsers to a page explaining the situation via something like this Apache configuration which redirects MSIE to /msie/:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} .*MSIE.*
RewriteCond %{REQUEST_URI} !^/msie/$
RewriteRule .* /msie/ [R]

Browser Compliance Notification

While HTML is still being used, all browsers should include a small icon indicating whether it was able to render the page in Standards Compliance Mode, or had to fall back to Quirks Mode, so that HTML authors can more easily see when they have written a page poorly, and correct it.

Future Compatibility: HTML5

HTML5 is the next standard, replacing both HTML4 and XHTML, differentiated by their Content-Type. Right now you can write in XHTML 1.0 and check them for validation against HTML5. Just select Document Type: HTML5.


Return to Index.
Contact Darxus.
Sat Jul 18 11:21:04 EDT 2009