text/javascript
The MIME type for JavaScript source files used to add interactivity to web pages.
What Is This?
The text/javascript MIME type indicates that the content is a JavaScript source file. While text/javascript is the historical standard, application/javascript and application/ecmascript are also widely recognized. Modern browsers treat all these types the same way — they parse and execute the script.
Common Uses
External JavaScript files loaded via <script> tags
JavaScript module files
Server-side JavaScript responses
CDN-hosted library files
Examples
Supported by all browsers. Both text/javascript and application/javascript are treated equivalently.
The .js file extension maps to text/javascript as its MIME type.
Related Entries
More from this reference:
Frequently Asked Questions
Should I use text/javascript or application/javascript?
According to RFC 9239, application/javascript is the official MIME type for JavaScript. However, text/javascript is still widely supported and used interchangeably. Most servers and browsers handle both correctly.
What MIME type should I use for ES modules?
ES modules use the same MIME type (text/javascript or application/javascript). The module behavior is determined by the type='module' attribute in the <script> tag, not the MIME type.