The Document.contentType read-only property returns the MIME type that the document is being rendered as.
Document.contentType
MDN Reference