MIME Types Reference

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

1

External JavaScript files loaded via <script> tags

2

JavaScript module files

3

Server-side JavaScript responses

4

CDN-hosted library files

Examples

Browser Support

Supported by all browsers. Both text/javascript and application/javascript are treated equivalently.

File Extension

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.