JavaScript – Document.characterSet
JavaScript Document.characterSet property returns the character set being used by the document.
Syntax
The syntax to read characterSet
property of the document is
</>
Copy
document.characterSet
Document.characterSet property is read-only.
Example
In the following example, we read the characterSet
property value of this document and write it to #output.
index.html
</>
Copy
<!DOCTYPE html>
<html lang="en">
<body>
<p id="output"></p>
<script>
var output = document.getElementById('output');
var result = document.characterSet;
output.innerHTML = result;
</script>
</body>
</html>
Conclusion
In this JavaScript Tutorial, we have learnt about Document.characterSet property, with examples.