Welcome to Developer's Home Saturday, April 19, 2014
Home - DevelopersHome.com

What are MIME Types?


Preferences - Do not show ads

  • When a web or WAP browser receives a document, it needs some way to determine the type of contents the document contains so that it can decide how to deal with the document.

  • MIME (Multipurpose Internet Mail Extensions) is developed for such purpose.

  • A MIME type is associated to a file type.

  • For example, the MIME type "text/html" is associated to HTML files and the MIME type "text/vnd.wap.wml" is associated to WML files.

Web servers choose a suitable MIME type and include it in an HTTP response automatically. They keep a conversion table that contains the mappings between MIME types and file extensions.

For example, let's say a WAP browser requests a WML file named helloWorld.wml from a web / WAP server. The web / WAP server will search for the MIME type associated to the ".wml" extension in the conversion table and includes it in the HTTP response automatically.


WAP 1.x / WAP 2.0 MIME Types and File Extensions

Before a web / WAP server can be used to serve WAP 1.x or WAP 2.0 content, you need to make sure its MIME settings have been configured properly. Otherwise WAP browsers cannot display the WAP pages.

The latest versions of some web servers have set the MIME types of WAP 1.x and WAP 2.0 properly by default, which means you do not need to modify anything.

The following table lists the MIME types of WAP 1.x:


File extension

MIME type

Contents of the file

.wml

text/vnd.wap.wml

WML markup in plain-text form

.wmlc

application/vnd.wap.wmlc

Compiled WML markup

.wbmp

image/vnd.wap.wbmp

WBMP image

.wmls

text/vnd.wap.wmlscript

WMLScript code in plain-text form

.wmlsc

application/vnd.wap.wmlscriptc

Compiled WMLScript code


The following table lists the MIME types of WAP 2.0:


File extension

MIME type

Contents of the file

.xhtml or .html or .htm

application/vnd.wap.xhtml+xml

or

application/xhtml+xml

or

text/html

XHTML MP markup in plain-text form

.css

text/css

WCSS (WAP CSS or Wireless CSS) code in plain-text form


As you can see in the above table, there are three possible MIME types for XHTML MP files:

  • application/vnd.wap.xhtml+xml
    This is the MIME type specified by the Open Mobile Alliance. If "application/vnd.wap.xhtml+xml" is not set as the MIME type, XHTML MP documents cannot be viewed on some WAP browsers (e.g. browsers on some Nokia Series 60 mobile phones).

  • application/xhtml+xml
    This is the MIME type for XHTML Family document types. (XHTML MP belongs to the XHTML family.)

  • text/html
    This is the MIME type for HTML documents. XHTML MP is HTML-compatible.

    Advantage of using "text/html": Using "text/html" ensures that XHTML MP documents can be displayed on ordinary web browsers. Some web browsers (e.g. Internet Explorer 6) do not display documents with MIME types like "application/vnd.wap.xhtml+xml" and "application/xhtml+xml".
    For example, let's say "application/vnd.wap.xhtml+xml" is associated to your XHTML MP documents. If you use IE 6 to load any one of them, it will pop up a dialog box asking you whether to save the file on the hard disk.

    Disadvantage of using "text/html": Browsers will parse XHTML MP documents as HTML documents but not XML documents. Hence, invalid XML syntax may not be detected.

Sometimes you may want to detect the MIME types supported by a client browser and then assign an appropriate MIME type to your XHTML MP documents dynamically. For example, if you find that a browser supports the "application/vnd.wap.xhtml+xml" type, you will assign "application/vnd.wap.xhtml+xml" to your XHTML MP documents. If you find that a browser only supports the "text/html" type (e.g. IE 6), you will assign "text/html" to your XHTML MP documents. Please refer to the "Choosing MIME Types Dynamically" section of our XHTML MP tutorial if you want to learn the details.

Preferences - Do not show ads


Page 3 of 13 Previous Page | Next Page
Contents at a Glance
Print this Web Page | | Back to Top
Custom Search

Feedback Form (Expand)

What do you think about this web page?






WAP Server Setup Tutorial - Table of Contents WAP Server Setup Tutorial - Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page