Skip to content
Related Articles

Related Articles

Improve Article
HTML | DOM characterSet Property
  • Last Updated : 24 Jul, 2019

The characterSet property is used to return the character encoding for the document at the time of parsing. It is the character set that has been used for the document rendering also the user can override the encoding. The characterSet property will return null if the document is created in memory.




<!DOCTYPE html>
    <title>DOM characterSet Property</title>
        h1 {
            color: green;
        h2 {
            font-family: Impact;
        body {
            text-align: center;
    <h2>DOM characterSet Property</h2>
    <p>For returning the characterSet of the current URL,
      click on the button: </p>
    <button onclick="myFunction()">Try it</button>
    <p id="demo"></p>
   <!-- Script to get the characterSet -->
        function myFunction() {
            var x = document.characterSet;
            document.getElementById("demo").innerHTML = x;


After clicking on the button:

Supported Browsers:

  • Google Chrome 45.0
  • Internet Explorer 9.0
  • Firefox 44.0
  • Opera 34.0
  • Safari 9.0

My Personal Notes arrow_drop_up
Recommended Articles
Page :