document.characterSet Redirect 1

« DOM Reference

Summary

Returns the character encoding of the current document.

Syntax

document.characterSet

Examples

var string = document.characterSet;
<button onclick="alert(document.characterSet);">Show character set</button>
// returns document's character set, such as "ISO-8859-1" or "UTF-8"

Notes

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

The related, nonstandard method document.charset and the property document.defaultCharset are not supported by Gecko.

Specification

See: document.characterSet and the Encoding Standard.

Document Tags and Contributors

 Last updated by: Sheppy,