The inputEncoding property returns the character encoding used for parsing the document. This property doesn’t have any default value.
Syntax:
document.inputEncoding
Parameters:
- The HTML DOM inputEncoding property does not require any parameter.
Return Value:
- The HTML DOM inputEncoding property returns a String which represents the document’s character encoding.
Example:
html
<!DOCTYPE html>
< html >
< head >
< title >
HTML | DOM inputEncoding Property
</ title >
</ head >
< body >
< p >
Click the button to check the
encoding of this document
</ p >
< button onclick = "geek()" >
Alert document's encoding
</ button >
< script >
function geek() {
var docEncoding = document.inputEncoding;
alert(docEncoding);
}
</ script >
</ body >
</ html >
|
Output: Before clicking the button:

After clicking the button:

Supported Browsers: The browser supported by DOM inputEncoding() Property are listed below:
- Google Chrome
- Internet Explorer 9.0+
- Firefox
- Opera 15.0+
- Safari
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
13 Jun, 2023
Like Article
Save Article