English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML DOM characterSet Property

HTML DOM Document Object

characterSetA read-only property that returns the character encoding of the document.

Character encoding is a set of characters and how bytes are interpreted as these characters.

The properties document.charset and document.inputEncoding are old aliases of document.characterSet. They are no longer used.

Syntax:

document.characterSet
<button onclick="alert(document.characterSet);">Show Character Encoding</button>
Test See‹/›

Browser Compatibility

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

Property
characterSet454434912

Technical Details

Return Value:A string representing the document character encoding
DOM Version:DOM Level3

HTML DOM Document Object