HTML <script> type Attribute
Example
<script type="application/javascript">
document.write("Hello World!");
</script>
Meaning
The type attribute should be set to the MIME type corresponding to the scripting language used.
In practice, the language attribute is more commonly used, but the type attribute is standard. When not specified, the default value is text/javascript.
There is specification that it should actually be application/javascript, but given that browser support for this value is not consistent it is dangerous to use.
Also, it is possible to specifies version information in the type attribute for certain browsers, to indicate JavaScript 1.1 you would use <script type="application/javascript;version=1.1">.
Standard Syntax
<script type="scriptType"></script>
Advertisement
Attribute Values
| Value | Description |
|---|---|
| scriptType | Specifies the type of the script.
|