ApplicationText-based

application/javascript

JavaScript

Reference for application/javascript, the MIME type for JavaScript source code served by web servers and CDNs.

MIME Type Detector

Drop a file to detect its MIME type — no upload, runs in your browser

📄

Drop any file here or click to choose

Expected extensions: .js, .mjs

HTTP Content-Type Header

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

Associated File Extensions

.js.mjs

Quick Facts

MIME Typeapplication/javascript
CategoryApplication
TypeText-based (human-readable)
Extensions.js, .mjs

Common Usage

JavaScript files served over HTTP should use this MIME type. Browsers require correct MIME types for script execution due to strict MIME checking.

It is used for serving JS bundles from web servers, CDNs, and build tools like Webpack, Vite, and esbuild.

Code Examples

HTML
<!-- Link or embed with explicit type -->
<link rel="stylesheet" href="file.js" type="application/javascript">

<!-- Or for script/media elements -->
<script type="application/javascript" src="file.js"></script>
Node.js
// Express.js
app.get('/file', (req, res) => {
  res.type('application/javascript');
  res.send(data);
});

// Node.js http
res.writeHead(200, { 'Content-Type': 'application/javascript' });
nginx
# nginx.conf — add to types block or use default
types {
    application/javascript  js mjs;
}

# Or set for a specific location
location /api/ {
    default_type application/javascript;
}

Related MIME Types

More Application MIME Types

Other application types in the Application family

Related Tools

Explore More MIME Types

Browse our complete reference of 185 MIME types with usage examples, HTTP headers, and code snippets.