DevKits

application/*

application/javascript

File extensions: .js, .mjs

JavaScript source served for execution in a browser or Node.

What is application/javascript?

application/javascript is the traditional media type for JavaScript. Modern specs prefer text/javascript, but application/javascript remains widely used and is accepted by every browser and runtime.

Typical usage

External <script src> files, JavaScript modules, Node.js source distributions.

Common gotchas

The HTML spec now recommends text/javascript as the canonical type. Both work — do not mix them within one <script> tag's charset assumptions.

HTTP header example

Response header

Content-Type: application/javascript; charset=utf-8

Reference

RFC 4329 (obsoleted; see HTML Living Standard)

Frequently asked questions

What is the application/javascript MIME type?

application/javascript is the traditional media type for JavaScript. Modern specs prefer text/javascript, but application/javascript remains widely used and is accepted by every browser and runtime.

What file extension does application/javascript use?

Files served as application/javascript typically use the extensions .js, .mjs. The most common is .js.

How do I set the Content-Type for application/javascript?

Send the HTTP response header Content-Type: application/javascript; charset=utf-8. External <script src> files, JavaScript modules, Node.js source distributions.

Is application/javascript an official MIME type?

Yes. application/javascript is officially registered with IANA (RFC 4329 (obsoleted; see HTML Living Standard)), so standards-conformant clients recognize it.

What are common mistakes with application/javascript?

The HTML spec now recommends text/javascript as the canonical type. Both work — do not mix them within one <script> tag's charset assumptions.

Related MIME types

Handle application/javascript with these tools