text/*
text/javascript
File extensions: .js, .mjs
JavaScript source — the modern canonical media type for JS files.
What is text/javascript?
text/javascript is the canonical media type recommended by the HTML Living Standard for JavaScript files. It replaces application/javascript in modern usage, though both still work in every browser.
Typical usage
External <script src> files, ES modules, service workers.
Common gotchas
ES modules require the correct MIME type. Serving a .mjs file as text/plain or application/octet-stream causes the browser to reject the module load.
HTTP header example
Response header
Content-Type: text/javascript; charset=utf-8Reference
HTML Living Standard