Javascript DOM HTML Document characterSet Property

Introduction

Display the character encoding for this document:

var x = document.characterSet;

Click the button to check the encoding of this document.

View in separate window

<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Test</button>
<p id="demo"></p>

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

</body>
</html>

The characterSet property returns the character encoding for the document.

This property is an alias of document.inputEncoding and document.charset.




PreviousNext

Related