Easy Tutorial
❮ Event Frame Onload Jsref Map ❯

Script type Attribute

Script Object

Example

Retrieve the MIME type of a script:

x Output result:


Definition and Usage

The type attribute sets or returns the value of the type attribute of a script.

The type attribute specifies the MIME type of a script.

The type attribute identifies the content between the <script> and </script> tags.

A MIME type consists of two parts: media type and subtype. For JavaScript, the MIME type is "text/javascript".

Note: In HTML5, the type attribute is no longer required. The default value is "text/javascript".


Browser Support

All major browsers support the type attribute.


Syntax

Return the type attribute:

Set the type attribute:

Attribute Values

Value Description
MIME_type Specifies the MIME type of the script. <br> <br>Some common values: text/javascript (default)<br> text/ecmascript<br> application/ecmascript<br> application/javascript<br> text/vbscript See IANA MIME Types for a complete list of standard MIME types.

Technical Details

| Return Value: | A string, representing the MIME type of the script. | | --- | --- |


Related Articles

HTML Reference: HTML <script> type Attribute


Script Object

❮ Event Frame Onload Jsref Map ❯