HTML DOM Document characterSet attribute

Definition and usage

characterSet The property returns the document character encoding.

See also:

HTML Character Set Reference Manual

Deprecated alias:

Dcument charset attribute

Document inputEncoding attribute

Example

Get the document character encoding:

encoding = document.characterSet;

Try it yourself

Syntax

document.characterSet

Return value

Type Description
String Document character encoding.

Browser support

document.characterSet It is a feature of DOM Level 3 (2004). It is a feature of DOM Level 3 (2004).

All browsers fully support it:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support 9-11 Support Support Support Support