HTML DOM characterSet Property
THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML DOM characterSet Property

❮ Document Object

Example

Display the character encoding for this document:

var x = document.characterSet;
Try it Yourself »

Definition and Usage

The characterSet property returns the character encoding for the document.

The character encoding is the character set used for rendering the document, which may differ from the encoding specified by the page (the user can override the encoding).

The characterSet property returns the character encoding at the time of parsing, and will return null if the document is created in memory.

For more information on character sets, visit our HTML Charsets Reference.

Note: This property is an alias of document.inputEncoding and document.charset.


Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
characterSet 45.0 9.0 44.0 9.0 34.0

Syntax

document.characterSet

Technical Details

Return Value: A String, representing the document's character encoding
DOM Version Core Level 3 Document Object

❮ Document Object