HTML | DOM characterSet Property
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.
Syntax:
document.characterSet
Example:
<!DOCTYPE html> <html> <head> <title>DOM characterSet Property</title> <style> h1 { color: green; } h2 { font-family: Impact; } body { text-align: center; } </style> </head> <body> <h1>GeeksforGeeks</h1> <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 --> <script> function myFunction() { var x = document.characterSet; document.getElementById("demo").innerHTML = x; } </script> </body> </html> |
chevron_right
filter_none
Output:

After clicking on the button:

Supported Browsers:
- Google Chrome 45.0
- Internet Explorer 9.0
- Firefox 44.0
- Opera 34.0
- Safari 9.0
Recommended Posts:
- HTML | DOM URL Property
- HTML | DOM id Property
- HTML | DOM li value Property
- HTML | DOM dir Property
- HTML | DOM specified Property
- HTML | DOM value Property
- HTML | DOM name Property
- HTML | DOM Bdo dir Property
- HTML | DOM nodeType Property
- HTML | DOM domain Property
- HTML | DOM ins cite Property
- HTML | DOM offsetHeight Property
- HTML | DOM inputEncoding Property
- HTML | KeyboardEvent which Property
- HTML | DOM className Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



