JavaScript

text/javascript

Extensions
.js .mjs
Compressible
yes
Charset
UTF-8
Status
IANA-registered

Back from the dead and now the only correct type for JavaScript. RFC 4329 deprecated it in favor of application/javascript in 2006; browsers ignored the memo and kept shipping text/javascript, and RFC 9239 bowed to reality in 2022 — this is the registered type, and everything else is an alias to stop using. The label matters more than it used to: module scripts and workers actually check for a JavaScript type where classic script tags never did. Always UTF-8, no charset needed.

.mjs exists so Node.js can tell ES modules from CommonJS; over HTTP both are plain text/javascript.

Defined by RFC 9239 · IANA registration. Registry facts from the IANA media-types registry via mime-db.