<html>
<body>
<p id="demo">Click the button to check the encoding of this document</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
var x=document.getElementById("demo");
x.innerHTML=document.inputEncoding;
}
</script>
<p><strong>Note:</strong> Opera and Internet explorer 8 and earlier does not support the inputEncoding property.</p>
</body>
</html>