Document characterSet Property - Javascript DOM

Javascript examples for DOM:Document characterSet

Description

The characterSet property returns the character encoding for the document.

Return Value

A String, representing the document's character encoding

The following code shows how to Display the character encoding for this document:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">check the encoding of this document</button>

<p id="demo"></p>

<script>
function myFunction() {/* w  ww  . j a  v a 2  s.  c om*/
    var x = document.characterSet;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials