HTML - DOM Document inputEncoding Property



HTML DOM document inputEncoding property returns the character encoding for the parsable HTML document and is overwritable. The inputEncoding property is now deprecated.

Syntax

document.inputEncoding;

Return Value

It returns a String which represents the documents character encoding.

Example of HTML DOM Document 'inputEncoding' Property

Here is an example displaying character encoding of the document.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>
        HTML DOM document inputEncoding Property
    </title>
</head>
<body>
    <p>
        Click to check the encoding of the HTML document.
    </p>
    <button onclick="fun()">Click me</button>
    <p id="ipenc"></p>
    <script>
        let x = document.getElementById("ipenc");
        function fun() {
            x.textContent = document.inputEncoding;
        }
    </script>
</body>
</html>

Supported Browsers

Property Chrome Edge Firefox Safari Opera
inputEncoding No No No No No
html_dom_document_reference.htm
Advertisements