Easy Tutorial
❮ Tag Var Av Prop Readystate ❯

HTML <script> charset Attribute

HTML <script> Tag

Example

External JavaScript with UTF-8 character set:


Browser Support

All major browsers support the charset attribute.


Definition and Usage

The charset attribute specifies the character encoding used in an external script file.

This attribute is used when the character encoding of the external script file differs from the encoding of the HTML document.


Tips and Notes

Note: The charset attribute is only applicable to external scripts (only when the src attribute is used).


Differences Between HTML 4.01 and HTML5

None.


Syntax

Attribute Values

Value Description
charset Specifies the character encoding of the external script file. Some common values: "ISO-8859-1" - Standard encoding for the Latin alphabet<br> "UTF-8" - Unicode character encoding, compatible with ASCII. Refer to our Character Sets Reference for a complete list of character sets.

❮ Tag Var Av Prop Readystate ❯