Html code mime type

Список MIME-типов¶

MIME-тип — тип данных, которые могут быть переданы посредством сети интернет с применением стандарта MIME.

Согласно RFC 2045, RFC 2046, RFC 4288, RFC 4289 и RFC 4855 выделяются следующие базовые типы передаваемых данных:

  • application
  • audio
  • example
  • image
  • message
  • model
  • multipart
  • text
  • video

application¶

Внутренний формат прикладной программы

  • application/atom+xml: Atom
  • application/EDI-X12: EDI X12 (RFC 1767)
  • application/EDIFACT: EDI EDIFACT (RFC 1767)
  • application/json: JavaScript Object Notation JSON (RFC 4627)
  • application/javascript: JavaScript (RFC 4329)
  • application/octet-stream: двоичный файл без указания формата (RFC 2046)
  • application/ogg: Ogg (RFC 5334)
  • application/pdf: Portable Document Format, PDF (RFC 3778)
  • application/postscript: PostScript (RFC 2046)
  • application/soap+xml: SOAP (RFC 3902)
  • application/font-woff: Web Open Font Format
  • application/xhtml+xml: XHTML (RFC 3236)
  • application/xml-dtd: DTD (RFC 3023)
  • application/xop+xml:XOP
  • application/zip: ZIP
  • application/gzip: Gzip
  • application/x-bittorrent : BitTorrent
  • application/x-tex : TeX
  • application/xml: XML

audio¶

  • audio/basic: mulaw аудио, 8 кГц, 1 канал (RFC 2046)
  • audio/L24: 24bit Linear PCM аудио, 8-48 кГц, 1-N каналов (RFC 3190)
  • audio/mp4: MP4
  • audio/aac: AAC
  • audio/mpeg: MP3 или др. MPEG (RFC 3003)
  • audio/ogg: Ogg Vorbis, Speex, Flac или др. аудио (RFC 5334)
  • audio/vorbis: Vorbis (RFC 5215)
  • audio/x-ms-wma: Windows Media Audio
  • audio/x-ms-wax: Windows Media Audio перенаправление
  • audio/vnd.rn-realaudio: RealAudio
  • audio/vnd.wave: WAV(RFC 2361)
  • audio/webm: WebM

image¶

  • image/gif: GIF(RFC 2045 и RFC 2046)
  • image/jpeg: JPEG (RFC 2045 и RFC 2046)
  • image/pjpeg: JPEG
  • image/png: Portable Network Graphics(RFC 2083)
  • image/svg+xml: SVG
  • image/tiff: TIFF(RFC 3302)
  • image/vnd.microsoft.icon: ICO
  • image/vnd.wap.wbmp: WBMP
  • image/webp: WebP

message¶

  • message/http (RFC 2616)
  • message/imdn+xml: IMDN (RFC 5438)
  • message/partial: E-mail (RFC 2045 и RFC 2046)
  • message/rfc822: E-mail; EML-файлы, MIME-файлы, MHT-файлы, MHTML-файлы (RFC 2045 и RFC 2046)

model¶

  • model/example: (RFC 4735)
  • model/iges: IGS файлы, IGES файлы (RFC 2077)
  • model/mesh: MSH файлы, MESH файлы (RFC 2077), SILO файлы
  • model/vrml: WRL файлы, VRML файлы (RFC 2077)
  • model/x3d+binary: X3D ISO стандарт для 3D компьютерной графики, X3DB файлы
  • model/x3d+vrml: X3D ISO стандарт для 3D компьютерной графики, X3DV VRML файлы
  • model/x3d+xml: X3D ISO стандарт для 3D компютерной графики, X3D XML файлы
  • multipart[править | править вики-текст]
  • multipart/mixed: MIME E-mail (RFC 2045 и RFC 2046)
  • multipart/alternative: MIME E-mail (RFC 2045 и RFC 2046)
  • multipart/related: MIME E-mail (RFC 2387 и используемое MHTML (HTML mail))
  • multipart/form-data: MIME Webform (RFC 2388)
  • multipart/signed: (RFC 1847)
  • multipart/encrypted: (RFC 1847)
Читайте также:  Html knowledge base template

text¶

  • text/cmd: команды
  • text/css: Cascading Style Sheets (RFC 2318)
  • text/csv: CSV (RFC 4180)
  • text/html: HTML (RFC 2854)
  • text/javascript (Obsolete): JavaScript (RFC 4329)
  • text/plain: текстовые данные (RFC 2046 и RFC 3676)
  • text/php: Скрипт языка PHP
  • text/xml: Extensible Markup Language (RFC 3023)
  • text/markdown: файл языка разметки Markdown (RFC 7763)

video¶

  • video/mpeg: MPEG-1 (RFC 2045 и RFC 2046)
  • video/mp4: MP4 (RFC 4337)
  • video/ogg: Ogg Theora или другое видео (RFC 5334)
  • video/quicktime: QuickTime
  • video/webm: WebM
  • video/x-ms-wmv: Windows Media Video
  • video/x-flv: FLV
  • video/3gpp: .3gpp .3gp
  • video/3gpp2: .3gpp2 .3g2

vnd¶

  • application/vnd.oasis.opendocument.text: OpenDocument
  • application/vnd.oasis.opendocument.spreadsheet: OpenDocument
  • application/vnd.oasis.opendocument.presentation: OpenDocument
  • application/vnd.oasis.opendocument.graphics: OpenDocument
  • application/vnd.ms-excel: Microsoft Excel файлы
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet: Microsoft Excel 2007 файлы
  • application/vnd.ms-powerpoint: Microsoft Powerpoint файлы
  • application/vnd.openxmlformats-officedocument.presentationml.presentation: Microsoft Powerpoint 2007 файлы
  • application/msword: Microsoft Word файлы
  • application/vnd.openxmlformats-officedocument.wordprocessingml.document: Microsoft Word 2007 файлы
  • application/vnd.mozilla.xul+xml: Mozilla XUL файлы
  • application/vnd.google-earth.kml+xml: KML файлы (например, для Google Earth)

  • application/x-www-form-urlencoded Form Encoded Data
  • application/x-dvi: DVI
  • application/x-latex: LaTeX файлы
  • application/x-font-ttf: TrueType (не зарегистрированный MIME-тип, но наиболее часто используемый)
  • application/x-shockwave-flash: Adobe Flash
  • application/x-stuffit: StuffIt
  • application/x-rar-compressed: RAR
  • application/x-tar: Tarball
  • text/x-jquery-tmpl: jQuery
  • application/x-javascript:

x-pkcs¶

  • application/x-pkcs12: p12 файлы
  • application/x-pkcs12: pfx файлы
  • application/x-pkcs7-certificates: p7b файлы
  • application/x-pkcs7-certificates: spc файлы
  • application/x-pkcs7-certreqresp: p7r файлы
  • application/x-pkcs7-mime: p7c файлы
  • application/x-pkcs7-mime: p7m файлы
  • application/x-pkcs7-signature: p7s файлы

Источник

Properly configuring server MIME types

MIME types describe the media type of content, either in email, or served by web servers or web applications. They are intended to help provide a hint as to how the content should be processed and displayed.

  • text/html for HTML documents.
  • text/plain for plain text.
  • text/css for Cascading Style Sheets.
  • text/javascript for JavaScript files.
  • text/markdown for Markdown files.
  • application/octet-stream for binary files where user action is expected.

Server default configurations vary wildly and set different default MIME-type values for files with no defined content type.

Versions of the Apache Web Server before 2.2.7 were configured to report a MIME type of text/plain or application/octet-stream for unknown content types. Modern versions of Apache report none for files with unknown content types.

Nginx will report text/plain if you don’t define a default content type.

As new content types are invented or added to web servers, web administrators may fail to add the new MIME types to their web server’s configuration. This is a major source of problems for users of browsers that respect the MIME types reported by web servers and applications.

Why are correct MIME types important?

If a web server or application reports an incorrect MIME type for content (including a «default type» for unknown content), a web browser has no way of knowing the author’s intentions. This may cause unexpected behavior.

Читайте также:  Pause in function javascript

Some web browsers may try to guess the correct MIME type. This allows misconfigured web servers and applications to continue working for those browsers (but not other browsers that correctly implement the standard). Apart from violating the HTTP spec, this is a bad idea for a couple of other significant reasons:

If the browser ignores the reported MIME type, web administrators and authors no longer have control over how their content is to be processed.

For example, a website oriented for web developers might wish to send certain example HTML documents as either text/html or text/plain in order to have the documents either processed and displayed as HTML or as source code. If the browser guesses the MIME type, this option is no longer available to the author.

Some content types, such as executable programs, are inherently unsafe. For this reason, these MIME types are usually restricted in terms of what actions a web browser will take when given that type of content. An executable program should not be executed on the user’s computer and should at least cause a dialog to appear asking the user if they wish to download the file.

MIME type guessing has led to security exploits in Internet Explorer that were based upon a malicious author incorrectly reporting a MIME type of a dangerous file as a safe type. This bypassed the normal download dialog, resulting in Internet Explorer guessing that the content was an executable program and then running it on the user’s computer.

JavaScript legacy MIME types

When looking for information about JavaScript MIME types, you may see several MIME types that reference JavaScript. Some of these MIME types include:

  • application/javascript
  • application/ecmascript
  • application/x-ecmascript
  • application/x-javascript
  • text/ecmascript
  • text/javascript1.0
  • text/javascript1.1
  • text/javascript1.2
  • text/javascript1.3
  • text/javascript1.4
  • text/javascript1.5
  • text/x-ecmascript
  • text/x-javascript

While browsers may support any, some, or all of these alternative MIME types, you should only use text/javascript to indicate the MIME type of JavaScript files.

Note: See MIME types (IANA media types) for more information.

How to determine the MIME type to set

There are several ways to determine the correct MIME type value to be used to serve your content.

  • If your content was created using commercial software, read the vendor’s documentation to see what MIME types should be reported for the application.
  • Look in IANA’s MIME Media Types registry, which contains information on all registered MIME types.
  • Search for the file extension in FILExt or the File extensions reference to see what MIME types are associated with that extension. Pay close attention as the application may have multiple MIME types that differ by only one letter.
Читайте также:  Club yeti ru forum showthread php

How to check the MIME type of received content

  • In Firefox
    • Load the file and go to Tools > Page Info to get the content type for the page you accessed.
    • You can also go to Tools > Web Developer > Network and reload the page. The request tab gives you a list of all the resources the page loaded. Clicking on any resource will list all the information available, including the page’s Content-Type header.
    • Load the file and go to View > Developer > Developer Tools and choose the Network tab. Reload the page and select the resource you want to inspect. Under headers look for Content-Type and it will report the content type of the resource.
    • According to the standards, the element that specifies the MIME type should be ignored if there’s a Content-Type header available.

    IANA keeps a list of registered MIME Media Types. The HTTP specification defines a superset of MIME types, which is used to describe the media types used on the web.

    How to set up your server to send the correct MIME types

    The goal is to configure your server to send the correct Content-Type header for each document.

    • If you’re using the Apache web server, check the Media Types and Character Encodings section of Apache Configuration: .htaccess for examples of different document types and their corresponding MIME types.
    • If you’re using Nginx, note that Nginx does not have a .htaccess equivalent tool, so all changes will go into the main configuration file.
    • If you’re using a server-side script or framework to generate content, the way to indicate the content type will depend on the tool you’re using. Check the framework or library’s documentation.

    Regardless of what server system you use, the effect you need to achieve is to set a response header with the name Content-Type , followed by a colon and space, followed by a MIME type. High-level environments often allow such headers to be set when generating the page. For example, in a PHP environment, you could set the response header for PDF resources like this:

    header('Content-Type: application/pdf') 

    Trying to instead set it with just header(‘application/pdf’) won’t work.

    Found a content problem with this page?

    This page was last modified on Jul 3, 2023 by MDN contributors.

    Your blueprint for a better internet.

    Источник

Оцените статью