YouTip LogoYouTip

Prop Script Character

# Script character Attribute [![Image 8: Script Object Reference](#) 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 ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) 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](#)
← Prop Script DeferProp Script Async β†’