Category: Application
application/javascript
application/javascript is the official IANA standard MIME type for JavaScript source code (superseding text/javascript in RFC 4329, though both are accepted by modern browsers).
MIME / CONTENT-TYPE
application/javascript
ASSOCIATED EXTENSIONS
.js, .mjs
PRIMARY CATEGORY
Application
HTTP Headers & Web Server Configurations
Standard HTTP Response Header
Content-Type: application/javascript; charset=utf-8Send this exact header in HTTP responses to instruct browsers how to decode and render the payload.
Node.js / Express / Web API
res.setHeader("Content-Type", "application/javascript; charset=utf-8");
res.setHeader("X-Content-Type-Options", "nosniff");NGINX Configuration (mime.types)
types {
application/javascript js mjs;
}Apache (.htaccess / httpd.conf)
AddType application/javascript .js .mjsSecurity Advisory & Hardening
Always enforce "X-Content-Type-Options: nosniff" to prevent browsers from executing non-JS files masquerading as scripts.
Frequently Asked Questions
application/javascript Questions & Answers
Common questions regarding MIME types, Content-Type headers, and web server configurations.
The standard HTTP response header is: "Content-Type: application/javascript; charset=utf-8".