Skip to content
Related Articles
Open in App
Not now

Related Articles

Which property can be used to return the doctype of any HTML document ?

Improve Article
Save Article
  • Last Updated : 01 Feb, 2022
Improve Article
Save Article

The document.contentType property in HTML DOM returns the doctype in which the document is being rendered. This is a read only property.


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.


<!DOCTYPE html>
    <h1 style="color:green">GeeksforGeeks</h1>
    <button onclick="get()">
        Get The Content Type of document
        function get() {


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!