Document characterSet Property - Javascript DOM

Javascript examples for DOM:Document characterSet


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>

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

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

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


Related Tutorials