Content type (also known as MIME type or Media type) is a standard label used on the internet to identify the format of a file or data stream. It tells web browsers, servers, and email clients how to process and display the information they receive. Common Examples Text: text/html (web pages), text/plain (plain text) Images: image/jpeg, image/png, image/gif
Application Data: application/json (API data), application/pdf (documents) Audio/Video: audio/mpeg (MP3), video/mp4 (MP4 video) Two-Part Structure
Every content type consists of two parts separated by a forward slash:
Type: The general category of the data (e.g., image, text, video).
Subtype: The exact, specific format of the data (e.g., png, html, mp4). Why It Matters
Correct Rendering: Browsers use it to know whether to display a file as a web page, play it as a video, or download it to your hard drive.
API Communication: Web applications use it to parse data correctly, ensuring a server knows it is receiving JSON data rather than plain text.
Security: Proper labeling prevents browsers from executing malicious code disguised as a harmless file format.
Leave a Reply