格 千格 KiloCell

MIME type query

Quick location file extension corresponds to the standard Content-Type response header

Extension Mime Type Notes Operation

What's the mime type (Content-Type)?

Mime Type (multipurpose Internet mail extension, Multipurpose Internet Mail Express) Media Type (Media Type) is an Internet standard that indicates the nature and format of the document, file or byte stream. In Web development, server via HTTP Response Header Content-Type to tell the browser how to handle the received contents.

1. Why is it essential to correctly configure the mimetype?

Browser does not always determine how to render a file by using the file extension. If one .css File misidentified by server text/plain , the browser may refuse to load it as a stylesheet, which may cause confusion in the page layout. Again, wrong mime Type configuration may also result in browsers popping up unnecessary downloads dialogue boxes or unable to play embedded audio and video content correctly.

Common mimetype structure

A standard mime type usually consists of type (Type) and subtype (Subtype), separated by a slash:

  • text/html: HTML document.
  • image/webp: WebP format picture.
  • application/json: JSON data format.
  • video/mp4: MP4 video file.

3. How can developers use this query tool?

This tool provides a one-stop reference for developers. Whether you are configure the Nginx server mime.types File, or set API response header in Node.js, simply enter an extension to get the standard Content-Type immediately String. We're covering the traditional. .pdf To modern. .wasm 、 .mjs .

4. Safety tip: MIME Sniffing

For safety, many modern servers will send them. X-Content-Type-Options: nosniff Response head. This means that the browser must strictly adhere to the MIME provided by the server. type, and not try to guess type based on content. So make sure your server returns the correct for each static resource The Content-Type is the key to building a secure, robust website.

Common issues (FAQ)

Q: application/javascript and text/javascript What's the difference?
A: According to the latest norms, text/javascript is the type of recommended use. ♪ Though ♪ application/javascript It was popular in the past, but it is now gradually being abandoned.

Q: What if I can't find the extension I need?
A: For unusual private formats, the common approach is to use application/octet-stream , which suggests that the browser downloads the content as a binary stream.

Copyed to clipboard