此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

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 ⁨2018年4月⁩.

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

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

contentType 是只读属性。

规范

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

浏览器兼容性