The document.contentType property in HTML DOM returns the doctype in which the document is being rendered. This is a read only property.
Syntax:
value = document.contentType;
Return value: This property returns a string value of MIME content type of the document.
Example: This example will show how to get the content MIME Type of the document using this property.
HTML
<!DOCTYPE html> <html>   <body>     <h1 style="color:green">neveropen</h1>       <button onclick="get()">         Get The Content Type of document     </button>       <script>         function get() {             alert(document.contentType);         }     </script> </body> </html> |
Output:

