HTML <script> charsetAttribute
Examples
External JavaScript with the UTF-8 character set:
<script src="myscripts.js.html"
charset="UTF-8"></script>
Try it Yourself »
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.
The charset attribute is used when the character encoding in an external script file differs from that in the HTML document.
Tips and Notes
Note:The charset attribute only applies to external scripts (only when the src attribute is used).
Differences Between HTML 4.01 and HTML5
None.
Syntax
<script charset="charset">
Attribute Values
| Value | Description |
|---|---|
| charset | Specifies the character encoding of the external script file. Some common values:
Please refer to ourCharacter Set Reference Manual, to obtain a complete list of character sets. |
HTML <script> Tag Other Extensions