HTML script charset attribute
Examples
Character set of external JavaScript UTF-8:
<script src="myscripts.js"
charset="UTF-8"></script>
try it"
Browser Support
All major browsers support the charset attribute.
Definition and Usage
charset attribute specifies the character encoding for use in external script file.
When an external script file character encoding and HTML document coding is not the same, it will use charset attribute.
Tips and Notes
Note: charset attribute applies only to external script (only when using the src attribute).
Differences between HTML 4.01 and HTML5
no.
grammar
<script charset="charset">
Property Value
值 | 描述 |
---|---|
charset | 规定外部脚本文件的字符编码。
一些常用的值:
请参阅我们的 字符集参考手册 ,获得完整的字符集列表。 |
HTML <script> tag