Script charset attribute
Definition and usage
charset
Attribute setting or returning the script's Charset attribute Value.
The charset attribute specifies the character encoding used in the external script file.
Use the charset attribute when the character encoding of the external script file is different from the encoding of the HTML document.
Note:The charset attribute is only applicable to external scripts (it can only be used when the src attribute exists).
See also:
HTML Reference Manual:ویژگی charset در <script> HTML
HTML Reference Manual:برچسب <script> HTML
Example
Get the character set used in the external script file:
var x = document.getElementById("myScript").charset
Syntax
Return charset attribute:
scriptObject.charset
Set charset attribute:
scriptObject.charset = charset
Attribute value
Value | Description |
---|---|
charset |
Specify the character encoding of the external script file. Common values:
لطفاً بهمرجع زبانهای نوشتاری، برای دریافت لیست کامل زبانهای نوشتاری، ببینید. |
جزئیات فنی
مقدار بازگشتی: | مقدار رشتهای که نشاندهنده زبان نوشتاری فایل اسکریپت خارجی است. |
---|
پشتیبانی از مرورگر
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
پشتیبانی | پشتیبانی | پشتیبانی | پشتیبانی | پشتیبانی |