Welcome to Developer's Home Wednesday, April 16, 2014
Home - DevelopersHome.com

Headers in HTTP Requests


Preferences - Do not show ads

Information about the type and capabilities of a client device such as a cell phone can be found in the headers of HTTP requests received at the server-side. Here are some of the headers that are useful for detecting user agent types, features and capabilities of client devices:

  • The Accept header

  • The User-Agent header

  • The Accept-Charset header

  • The Accept-Language header

  • The x-wap-profile header and the Profile header. They contain the URL to a UAProf document.


The Accept Header -- Find the MIME Media Types that will be Accepted by a User Agent

The Accept header contains a list of MIME media types that will be accepted by the user agent. We can use the Accept header to find out the file types that can be handled by the user agent. The Accept header contains something like this:


application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*


The above Accept header is generated by the Nokia 6230i cell phone emulator. It states that the Nokia 6230i cell phone can handle WMLScript scripts, WML documents, XHTML MP documents, HTML documents, etc. "*/*" means all MIME media types. Similarly, if you see "application/*", it means all MIME types that begin with "application/" are acceptable. If "*" is used in the Accept header, the information we can get is more limited. For example, some cell phones include the MIME type "text/vnd.sun.j2me.app-descriptor" in the Accept header, which tells us the cell phone is capable of running J2ME programs. However, if what we can find is "*/*", we are not sure whether the cell phone can ready handle J2ME programs or it can just accept the file and save it locally. In such cases, you may want to use other detection methods such as UAProf.

Now let's say the WML or XHTML MP document downloaded from a WAP server contains an inline image <img src="image.gif" ... />. The Nokia 6230i cell phone will send another HTTP request to the WAP server to get the image file. This time the Accept header will contain something like:


image/vnd.wap.wbmp, image/gif, image/jpg, image/jpeg, image/png, image/bmp, image/x-bmp


The above Accept header states that the Nokia 6230i cell phone accepts image formats like WBMP, GIF, JPEG, PNG, BMP, etc. From this information, we know that Nokia 6230i is a cell phone model that has a color screen since GIF, JPEG, PNG and BMP are image formats that support colors.

To learn further details about the Accept header, please refer to the HTTP/1.1 specification at http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1.


Common MIME Types List

The following table lists some common MIME types that you may find in the Accept header generated by a wireless device such as a cell phone:


File Type

MIME Media Type

Audio 3GPP files (.3gp)

audio/3gpp

Audio AMR files (.amr)

audio/amr

Audio AMR (wideband) files (.awb)

audio/amr-wb

Audio MIDI files (.mid or .midi)

audio/midi

Audio MP3 files (.mp3)

audio/mpeg

Audio MP4 files (.mp4)

audio/mp4

Audio WAV files (.wav)

audio/wav

audio/x-wav

HTML files (.html or .htm)

text/html

Image BMP files (.bmp)

image/bmp

image/x-bmp

Image GIF files (.gif)

image/gif

Image JPEG files (.jpg or .jpeg)

image/jpeg

Image PNG files (.png)

image/png

Image TIFF files (.tif or .tiff)

image/tiff

Image WBMP (Wireless BMP) files (.wbmp)

image/vnd.wap.wbmp

Java application JAR files (.jar)

application/java

application/java-archive

application/x-java-archive

Java application JAD files (.jad)

text/vnd.sun.j2me.app-descriptor

Plain text files (.txt)

text/plain

Symbian application SIS files (.sis)

application/vnd.symbian.install

Video 3GPP files (.3gp)

video/3gpp

Video MP4 files (.mp4)

video/mp4

WML files (compiled) (.wmlc)

application/vnd.wap.wmlc

WML files (plain text) (.wml)

text/vnd.wap.wml

WMLScript files (compiled) (.wmlsc)

application/vnd.wap.wmlscriptc

WMLScript files (plain text) (.wmls)

text/vnd.wap.wmlscript

XHTML MP files (.xhtml, .html or .htm)

application/vnd.wap.xhtml+xml

application/xhtml+xml

text/html


Preferences - Do not show ads


Page 2 of 10 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?






Detecting User Agent and Device Capabilities - Table of Contents Detecting User Agent and Device Capabilities - Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page