Prop Script Character
# Script character Attribute
[ Script Object](#)
## Example
Get the character set used in an external script file:
var x = document.getElementById("myScript").charset
The output of _x_ will be:
UTF-8
[Try it yourself Β»](#)
* * *
## Definition and Usage
The charset property sets or returns the value of the charset attribute of a script.
The charset property specifies the character encoding used in an external script file.
The charset property is used when the character encoding in an external script file is different from the encoding in the HTML document.
**Note:** The charset property only applies to external scripts (only when the src attribute is used).
* * *
## Browser Support

The charset property is supported by all major browsers.
* * *
## Syntax
Return the charset property:
_scriptObject_.charset
Set the charset property:
_scriptObject_.charset=_charset_
## Property Values
| Value | Description |
| --- | --- |
| _charset_ | Specifies the character encoding for the external script file. Some common values: * "ISO-8859-1" - Standard encoding for the Latin alphabet * "UTF-8" - Unicode character encoding. Compatible with ASCII Please refer to our (#) for a complete list of character sets. |
## Technical Details
| Return Value: | A string representing the URL of the external script file. Returns the full URL, including the protocol (e.g., http://). |
| --- |
* * *
## Related Articles
HTML Reference: (#)
* * Script Object](#)
YouTip