Document.contentType
The Document.contentType read-only property returns the MIME type that the document is being rendered as. This may come from HTTP headers or other sources of MIME information, and might be affected by automatic type conversions performed by either the browser or extensions.
Note: This property is unaffected by <meta> elements.
Syntax
contentType = document.contentType;
Value
contentType is a read-only property.
Specifications
| Specification |
|---|
| DOM Standard (DOM) # ref-for-dom-document-contenttype① |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
contentType |
36 |
17 |
1 |
No |
23
≤12.1-15
|
9 |
37 |
36 |
4 |
24
≤12.1-14
|
9 |
3.0 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Document/contentType