Nouplo

Tipi MIME

Che cosa mettere in Content-Type, e che cosa succede quando è sbagliato.

tipi
50
Risultato
html htm  text/html
            A web page. Always with charset=utf-8.
css       text/css
js mjs    text/javascript
            application/javascript is obsolete but still served everywhere.
json      application/json
            No charset parameter: JSON is UTF-8 by definition.
xml       application/xml
            text/xml is also registered and means the same to browsers.
txt       text/plain
csv       text/csv
md        text/markdown
yaml yml  application/yaml
            Registered in 2024; text/yaml is what older servers send.
pdf       application/pdf
zip       application/zip
gz        application/gzip
tar       application/x-tar
7z        application/x-7z-compressed
rar       application/vnd.rar
png       image/png
jpg jpeg  image/jpeg
            Note the type is jpeg even when the extension is jpg.
gif       image/gif
webp      image/webp
avif      image/avif
svg       image/svg+xml
            Served as anything else, a browser will not render it.
ico       image/x-icon
            image/vnd.microsoft.icon is the registered one; both work.
bmp       image/bmp
tif tiff  image/tiff
heic      image/heic
mp4 m4v   video/mp4
webm      video/webm
mov       video/quicktime
mp3       audio/mpeg
            Not audio/mp3, which is not registered.
m4a       audio/mp4
wav       audio/wav
            audio/x-wav and audio/wave appear in the wild too.
ogg oga   audio/ogg
flac      audio/flac
woff2     font/woff2
woff      font/woff
ttf       font/ttf
otf       font/otf
wasm      application/wasm
            Must be exact or streaming compilation refuses it.
doc       application/msword
docx      application/vnd.openxmlformats-officedocument.wordprocessingml.document
xls       application/vnd.ms-excel
xlsx      application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
ppt       application/vnd.ms-powerpoint
pptx      application/vnd.openxmlformats-officedocument.presentationml.presentation
epub      application/epub+zip
ics       text/calendar
vcf       text/vcard
srt       application/x-subrip
vtt       text/vtt
            Must be exact or the browser ignores the track.
bin       application/octet-stream
            The fallback: bytes with nothing said about them.

I tuoi file restano sul tuo dispositivo

Questo strumento viene eseguito interamente nel tuo browser. Ciò che incolli viene elaborato sul tuo dispositivo e non viene mai inviato a un server, quindi puoi usarlo in sicurezza con token, chiavi e testi non pubblicati.

Come funziona

  1. Lascia il riquadro vuoto per l’elenco.
  2. Scrivi un’estensione — png, oppure .png — per il suo tipo.
  3. Scrivi una parte di un tipo, come image/, per tutto ciò che vi rientra.
  4. Leggi le note: alcuni falliscono in sordina anziché rumorosamente.

Domande frequenti

Quali contano davvero?
Quelli su cui un browser si rifiuta di agire se sono sbagliati. Un SVG servito come text/plain non viene reso. Un modulo WebAssembly servito con qualcosa che non sia application/wasm non può essere trasmesso in streaming. Un file di sottotitoli .vtt con il tipo sbagliato non si carica, e non lo dice.
Si dice text/javascript o application/javascript?
text/javascript. application/javascript è stata la raccomandazione per anni ed è ormai superata, ma entrambe funzionano ovunque e la vecchia continuerai a incontrarla.
Devo aggiungere charset=utf-8?
A text/html e text/plain sì. A application/json no: il JSON è UTF-8 per definizione e un parametro charset lì non significa nulla, per quanto innocuo.
Che cos’è application/octet-stream?
«Dei byte, e non ti dirò quali». È la risposta giusta quando davvero non lo sai, e spinge il browser a scaricare anziché mostrare.
Viene inviato qualcosa a un server?
No. Gira nel browser: quello che scrivi resta sul tuo computer.

Strumenti correlati