HTML DOM Script src attribute
Examples
Get an external script files referenced character sets:
var x = document.getElementById ( "myScript" ) .charset
x The output is:
UTF-8
try it" 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.
Note: charset attribute applies only to external script (only when using the src attribute).
Browser Support
Attributes | |||||
---|---|---|---|---|---|
charset | Yes | Yes | Yes | Yes | Yes |
grammar
Returns the charset attribute:
scriptObject.charset
Set the charset attribute:
scriptObject.charset=charset
Property Value
value | description |
---|---|
charset | The character encoding specified external script file. Some common values:
See our character set reference manual for a complete list of character sets. |
technical details
return value: | String, returns the character set to use an external script file. |
---|