Fixit – MIME types

The MIME type is an internet standard which indicates the format of a message. The MIME type sent by a server provides important information to browsers on how to treat a document. This test determines if your page is being sent with the correct MIME types.

MIME types

Different types of document are sent with different MIME types. For example, some common file types, and their associated MIME types are listed below.

For XHTML Mobile Profile, and XHTML Basic, the recommended MIME type is application/xhtml+xml (under certain circumstances, application/vnd.wap.xhtml+xml and text/html are acceptable also, although they will generate a WARN in

Set up your server to send correct MIME types

Using .htaccess

If you are using Apache, you can us a .htaccess file to associate file extensions with MIME types. Simply add this line to a file called .htaccess in the folder of the files you wish to send with the correct MIME types. This will cover all files in this folder and sub-folders. If there already exists a file named .htaccess, be careful not to any instructions already in this file as would modify the behaviour of your server. In this case just add the line below to the file:

Using meta http-equiv tags

The meta http-equiv tag enables you to inform the HTTP server about the kinds of headers it may provide. If you do not have access to the server directly, but if you are able to modify your html pages then you can use a http-equiv meta tag directly in your content. Include the following line at the top of your page:

<meta http-equiv="Content-Type" content="application/xhtml+xml" />

Note, if the server sends a HTTP Content-type header, then any meta http-equiv="Content-type" tag may be ignored by the browser.

Using server side code

If you are using server side code to genereate your content then there is usually a method to set the server headers directly from within your server source code. Some examples are:

  • Java Servlets: Include the line:
  • response.setContentType("application/xhtml+xml");

    before any content is sent

  • JSP: include the line
  • response.setContentType("application/xhtml+xml");

    within scriptlet tags (i.e. <%….%>) before any other content.


    include the JSP directive

    <%@ page language="java" contentType="application/xhtml+xml" %>

    at the top of the page, before any content

  • PHP: include the line
  • header("Content-Type: application/xhtml+xml");

    before any other output line

  • ASP: include the line

    response.ContentType = "application/xhtml+xml"

    before any content is sent


This test is based on a W3C mobileOK best practice test. See for more details



  • kentwu1199 says:

    I got the below mention message when I tested the site’

    “The MIME types sent by servers give very important information to browsers as to how to treat a document. If incorrect MIME types are sent with a document, it may prevent the browser from correctly interpreting the document and failing to render a document.

    For XHTML-MP, the recommended MIME type is application/vnd.wap.xhtml+xml or application/xhtml+xml. Unlike HTML, XHTML-MP should not be served as text/html.

    Web servers are often set up correctly for common document types such as HTML and CSS, but often do not have the correct doc types for XHTML-MP. Please refer to mobiForge for instructions on how to set up your MIME types correctly.

    MIME type was detected as text/html; charset=UTF-8”

    I’m using Gomobi system. Is there a way to alter ?

Exclusive tips, how-tos, news and comment

Receive monthly updates on the world of mobile dev.

Other Products

Market leading device intelligence for the web, app and MNO ecosystems
DeviceAtlas - Device Intelligence

Real-time identification of fraudulent and misrepresented traffic
DeviceAssure - Device Verification

A free tool for developers, designers and marketers to test website performance
mobiReady - Evaluate your websites’ mobile readiness

© 2024 DeviceAtlas Limited. All rights reserved.

This is a website of DeviceAtlas Limited, a private company limited by shares, incorporated and registered in the Republic of Ireland with registered number 398040 and registered office at 6th Floor, 2 Grand Canal Square, Dublin 2, Ireland