Document.contentType - mime type
contentTypeは、Documentのプロパティです。ドキュメントのmime typeを返します。
概要
- 名前
- contentType
- 所属
- Document
- IDL
readonly attribute DOMString contentType;
- 仕様書
- https://dom.spec.whatwg.org/#dom-document-contenttype
説明
mime typeを返す。読み取り専用なので、値を代入して変更することはできない。
デモ
Document.contentTypeのデモです。
<!-- このコードは編集できます。 -->
<!DOCTYPE html>
<html>
<body>
<script>
var value = document.contentType ;
console.log( value ) ;
document.body.appendChild( new Text( value ) ) ;
</script>
</body>
</html>
サポート状況
Chrome | Firefox | Safari | Edge | IE | Opera | iOS Safari | Android |
---|---|---|---|---|---|---|---|
● 36+ | ● | ● 9.1+ | × | × | ● 23+ | ● 9.1+ | × |
関連記事
- Document.characterSet
- characterSetは、Documentのプロパティです。ドキュメントの文字エンコーディングを返します。
- Document.activeElement
- activeElementは、Documentのプロパティです。フォーカス中の要素を返します。フォーカス中の要素がなければbody要素、それもなければhtml要素、それもなければnullを返します。
- Document.documentElement
- documentElementは、Documentのプロパティです。ドキュメントのルート(最上位)の要素、すなわち、html要素を返します。
- Document.createRange()
- createRange()は、Documentのメソッドです。Rangeを新しく作成します。