Get document defaultCharset in JavaScript

Description

The following code shows how to get document defaultCharset.

Example


<!--from  w  w  w .  j a  v a  2 s  . c o m-->
<!DOCTYPE HTML>
<html>
<body>
<script>

document.writeln("defaultCharset: " + document.defaultCharset);
</script>
</body>
</html>

Click to view the demo

The code above generates the following result.

Get document defaultCharset in JavaScript