HTML DOM Document characterSet
Example
Get the character encoding for a document:
encoding = document.characterSet;
Try it Yourself »
Definition and Usage
The characterSet property returns the character encoding for a document.
See Also:
Deprecated Aliases:
Syntax
document.characterSet
Return Value
| Type | Description |
| String | The document's character encoding. |
Browser Support
document.characterSet is a DOM Level 3 (2004) feature.
It is fully supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera | IE |
| Yes | Yes | Yes | Yes | Yes | 9-11 |