Internet media type

From Helpful
(Redirected from Content type)
Jump to navigation Jump to search

Internet Media Type (previously known as MIME type), and sometimes referred to as Content-Type (from the HTTP header it is often seen in) are the type/subtype specification of the type of content.

It is used in

  • HTTP, most typically like Content-Type: text/plain; charset="UTF-8" (note: the charset part is optional but useful)
  • and in various other places

The official list of MIME types is kept by IANA:

x-, vnd-, and such

something/x- are private subtypes

are not registered
(cannot be registered as exactly that. The registered form is often the same without the x-)
in theory everything non-registered should have this. Many but not all follow this.

Similarly, if you think up new type, it should also start with x- (to avoid conflicts with future standard types)

vnd are used when tied to vendor-specific and publicly available products, though that's a bit of a fuzzy distinction.

See also:

On charsets

HTTP and MIME allow the specification of character set on text/ types.

The value should be one registered at:

Charset names are considered case insensitive (see e.g. RFC 2616 clause 3.4

...though some browsers/UAs have been known to be case sensitive(verify)

See also:

  • RFC 6657

See also

"What's the mime type for..." (some common stuff)

This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.

Note that source code is in theory application/ over text/ whenever it settles its own character set (in specs or the document itself), such as in the case of javascript and XML. See also RFC 4329 and this mention

  • CSS

  • Javascript
often text/javascript in practice
application/javascript in theory (see note above)
Also seen:

  • JSON
application/json (see also RFC 4627)
(note: JSONP is Javascript code, not JSON data)

  • XML:
text/xml in practice
application/xml in theory (see note above)

  • JPEG
You also see:
image/jpg (common mistake, not everything likes this)
image/pjpeg for progressive JPEG - not standard (though apparently acceptable?)
  • PNG
  • GIF

  • PDF:
application/pdf RFC 3778
Also sometimes seen:

  • MP3
audio/mpeg according to RFC 3003 and HTML5[1]
A web search also shows a dozen others

  • 'arbitrary binary data' (quoth e.g. RFC 2046)