Cover by Maximiliano Firtman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

Content Delivery

A common situation in the mobile web world is content delivery. Java applications, widgets, music, video, wallpapers, and any other content can be delivered to compatible devices, but this requires a bit of explanation and expertise.

Defining MIME Types

MIME types, many of which are listed in the Appendix A, are a key element for content delivery. Many mobile browsers don’t care about the file extension; they decide whether or not to accept the content based on the MIME type delivered by the server. Remember that the MIME type travels with the HTTP header response.

Static definition

The simplest way to define the right MIME types is to statically define them on your web server. If you are working with a shared hosting service, the control panels often allow you to define document MIME types. If you manage your own server, you can set them up with the following instructions.

Apache

In Apache, the simplest way is to open the mime.types file located in the conf folder of the Apache root. In your favorite text editor, you can add one row per MIME type to be configured.

You will find hundreds of MIME type declarations. The first thing to do is to look for the following line and change the MIME type to the correct one for mobile XHTML documents:

text/html                    html htm

As you can see, each line contains a MIME type followed by a series of spaces or tabs and a space-separated list of file extensions.

Warning

This technique applies these changes to all the websites on the server. If you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required