Document:contentType 属性

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Document.contentType 只读属性表示返回文档正在渲染的 MIME 类型。这可能来自 HTTP 标头或其他 MIME 信息源,并且可能会受到浏览器或扩展程序执行的自动类型转换的影响。

备注: 该属性不受 <meta> 元素的影响。

contentType 是只读属性。

规范

Specification
DOM
# ref-for-dom-document-contenttype①

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
contentType

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Has more compatibility info.