XHTML Properly Served

XHTML

Serving web pages as XHTML (properly served as application/xhtml+xml) is not a good idea. Why? The current most-used operating system component masquerading as a browser - Internet Explorer - cannot handle it. IE will offer to download the file rather than display it. Harrumph. Notice the Content-Type in the following two sets of Response Headers.

Using the proper Strict DOCTYPE of:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

...while sending the content-type of "application/xhtml+xml" will completely stuff up Internet Explorer, as it doesn't know what to do with an xhtml page. The failure will be the same for the XHTML Transitional DOCTYPE.

XHTML Response Headers:

Date: Sat, 20 Oct 2007 14:13:53 GMT
Server: Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 
   PHP/4.4.7 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a
X-Powered-By: PHP/4.4.7
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Keep-Alive: timeout=15, max=88
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/xhtml+xml; charset=utf-8
content-style-type: text/css
language: english
dialect: us

HTML

Use the HTML 4.01 Strict DOCTYPE instead of a Transitional:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">

...while sending the content-type of "text/html"

HTML Response Headers:

Date: Sat, 20 Oct 2007 14:15:38 GMT
Server: Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 
   PHP/4.4.7 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a
X-Powered-By: PHP/4.4.7
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8

If you are reading this page, chances are good that you are not using Microsoft Windows Internet Explorer.

Also note that any "Transitional" DOCTYPE is for updating old legacy pages, and not for use when creating new pages.

This page is valid XHTML 1.0 Strict

Ubuntu Logo



Copyright © 1997-2024 Tekrider.net. All rights reserved.
Contact me if you have a comment about anything.
It's Thursday the 28th of March at 11:54 in my neighborhood.