Skip to content
Related Articles

Related Articles

Improve Article

HTML DOM document contentType Property

  • Last Updated : 07 Jul, 2020

The contentType property in HTML DOM returns the MIME type 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>
    <button onclick="get()">
        Get The Content Type
        of document
        function get() {


    Before Click the Button:

    After Click the Button:

Supported Browsers:

  • Google Chrome
  • Edge
  • Firefox
  • Opera
  • Safari
  • Internet Explorer

Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :