HTML <script> type attribute
HTML <script> tag
Example
Insert a JavaScript in an HTML page:
<script type="text/javascript">
document.write("Hello World!");
</script>
|
Try it yourself!
|
Definition and Usage
The required type attribute specifies the MIME type of a script.
The type attribute identifies the content between the <script> and </script>
tags.
The MIME type consists of two parts: one media type and one subtype. For
JavaScript, the MIME type is "text/javascript".
Browser Support
The type attribute is supported in all major browsers.
Syntax
Attribute Values
Value |
Description |
MIME_type |
The MIME type. Some values:
- text/javascript
- text/ecmascript
- application/ecmascript
- application/javascript
- text/vbscript
Look at
IANA MIME types
for a complete list of standard MIME types.
Note: According to IANA, the "text/javascript"
MIME type is obsolete. The new standard is "application/javascript".
However, "application/javascript" is not supported by Internet Explorer. |
HTML <script> tag
|
|
|