html

What are All the Possible Values for HTTP “Content-Type” Header

The HTTP “Content-Type” Header is the identifier used to make the HTTP client and server understand the content or media type of the resource added in the document. It instructs the server on which media type the browser is looking for. The HTTP Content-Type header is supported by many browsers including “Google Chrome”, “Mozilla Firefox”, “Internet Explorer”, “Safari”, “Samsung browser” and “Opera”.

This blog will discuss about different values of the HTTP “Content-Type” Header.

How to Use the HTTP “Content-Type” Header?

The syntax to use the HTTP “Content-Type” Header is as follows:

header('Content-type: media type/value');

 

Types of the Values in HTTP “Content-Type” Header

The types of the content type values used in the HTTP “Content-Type” Header are as follows:

All Values in HTTP “Content-Type” Header

There are multiple values for each content type used in the HTTP “Content-Type” Header. Let’s enlist all the possible values of each content type of the HTTP “Content-Type” Header.

Application

When an application is supposed to be added to the document, the “application” content type is used in the header. There are different types of application file formats that the HTTP supports:

    • application/java-archive
    • application/EDI-X12
    • application/javascript
    • application/xml
    • application/pdf
    • application/octet-stream
    • application/ogg
    • application/zip
    • application/xhtml+xml
    • application/x-shockwave-flash
    • application/json
    • application/x-www-form-urlencoded
    • application/ld+json
    • application/EDIFACT

Audio

When there is a need to add the audio files to the document, the “audio” content type is used in the header. Audio can be added in different formats as follows:

    • audio/mpeg
    • audio/vnd.rn-realaudio
    • audio/x-wav
    • audio/x-ms-wma

Image

To add images in the document of different formats, there is the “image” content type and the following are the possible values for the Image content type:

    • image/gif
    • image/tiff
    • image/vnd.djvu
    • image/jpeg
    • image/svg+xml
    • image/png
    • image/x-icon
    • image/vnd.microsoft.icon

Multipart

The “multipart” content type is added to upload files or content of different types in a single document. The following four values for the “multipart” content-type are valid in HTTP:

    • multipart/mixed
    • multipart/related
    • multipart/form-data
    • multipart/alternative

Text

When there is a text file supposed to be added to the document, the “text” content type is used with any of the following six text format values:

    • text/css
    • text/javascript (obsolete)
    • text/plain
    • text/html
    • text/xml
    • text/csv

Video

To efficiently display the videos, the “video” content type is used with the following content type values:

    • video/mpeg
    • video/x-ms-wmv
    • video/x-msvideo
    • video/webm
    • video/mp4
    • video/x-flv
    • video/quicktime

VND (Vendor-specific)

Following are the values for the VND (Vendor-specific) content type for HTTP:

    • application/vnd.android.package-archive
    • application/vnd.openxmlformats-officedocument.presentationml.presentation
    • application/vnd.mozilla.xul+xml
    • application/vnd.oasis.opendocument.text
    • application/vnd.oasis.opendocument.presentation
    • application/vnd.oasis.opendocument.spreadsheet
    • application/vnd.ms-powerpoint
    • application/vnd.oasis.opendocument.graphics
    • application/vnd.ms-excel
    • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
    • application/vnd.openxmlformats-officedocument.wordprocessingml.document
    • application/msword

These are all the possible values for the HTTP “Content-Type” Header.

Conclusion

The HTTP “Content-Type” Header instructs the HTTP clients and server which type of file they must execute. There are multiple types of the HTTP “Content-Type” Header that includes application, audio, image, multipart, text, and video. Moreover, it comprises multiple values for these content or media types, for instance, text/html, application/pdf, audio/mpeg, etc. This blog is a good guide about different values used in the HTTP “Content-Type” header.

About the author

Hadia Atiq

A Software Engineer and Technical Writer passionate about learning and spreading knowledge of the latest technology. I utilize my writing skills to help readers understand the importance and usage of modern technology.