Visit Mozilla.org

DOM:document.characterSet

From MDC

« Gecko DOM Reference

Contents

[edit] Summary

Returns the character encoding of the current document.

[edit] Syntax

string = document.characterSet

[edit] Example

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

[edit] 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.

For a complete list of character sets, see: http://www.iana.org/assignments/character-sets.

[edit] Specification

DOM Level 0. Not part of any standard.