HTML and CSS Reference
In-Depth Information
Listing 4-1. HTTP Header Example
HTTP/1.1 200 OK
Date: Fri, 10 Sep 2010 10:05:08 GMT
Server: Apache/2.2.16 (Unix) PHP/5.3.3
Content-Location: index.html
Vary: negotiate,accept-language,accept-charset
TCN: choice
P3P: policyref=
Cache-Control: max-age=21600
Expires: Fri, 10 Sep 2010 16:05:08 GMT
Last-Modified: Fri, 21 Aug 2009 22:18:49 GMT
ETag: "3668bab8;37e77d1c"
Accept-Ranges: bytes
Content-Length: 11537
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Language: en
Internet Media Types (MIME)
Internet media types (also known as MIME types or content-types ) determine the way browsers handle web
documents. They are the file format identifiers of the Web. Thus, it is crucial to set the right media type for web site
components and web pages.
The Multipurpose Internet Mail Extensions (MIME) specification was introduced in 1992 by the Internet
Engineering Task Force (see Chapter 1 for more information on the IETF). Most specifications are available as an
IETF/ISOC Request for Comments (RFCs). Although the original MIME concept was designed to format non-ASCII
messages, 1 it is used in web browsers to make it possible to render or process files other than (X)HTML. The Internet
media types are standardized by IANA registration (again, see Chapter 1 for more information on the IANA) [2].
Nonstandard MIME types and subtypes can be recognized by their prefix, since they all begin with x- . Vendor-specific
subtypes begin with vnd. , while personal subtypes begin with prs.
Media types consist of a minimum of two parts: a type, a subtype, and optional parameters.
XML data can be assigned to two MIME media types: application/xml and text/xml . They are defined by RFC 3023
[3]. Further, MIME types can be identified by the suffix +xml . The most important media type from a web standardista's
point of view is the XML media type registered for XHTML, namely, application/xhtml+xml , which is defined in
RFC 3236 [4]. Although XHTML documents could be served with the application/xhtml+xml , application/xml , or
text/xml media type, W3C recommends serving XHTML as XML with its dedicated MIME type application/xhtml+xml
[5]. However, using this media type cannot guarantee proper XML handling without a correct XML header
(see Chapter 3 for more on XML headers). Furthermore, Internet Explorer 6 and earlier IE versions do not render the
contents of documents served as application/xhtml+xml ; instead, users are prompted to download the file.
if the media type for an XhtML web page is set to text/html , it will be parsed as htML. if the media type
is set to application/xhtml+xml , browsers will parse the document as XML. this is a huge difference! XhtML files
served with the proper MiMe cannot contain a single error; otherwise, the document will not be rendered, and the XML
parser will give an error, as already mentioned earlier in Chapters 1 and 3.
1 The advanced version, S/MIME, supports message encryption too.
Search WWH ::

Custom Search