Document.defaultView - Window
概要
- 名前
- defaultView
- 所属
- Document
- IDL
readonly attribute WindowProxy? defaultView;
- 仕様書
- https://html.spec.whatwg.org/multipage/window-object.html#dom-document-defaultview
説明
ドキュメントのWindowを返す。関連付けられていない場合はnullを返す。
デモ
Document.defaultViewのデモです。
<!-- このコードは編集できます。 -->
<!DOCTYPE html>
<html>
<body>
<script>
var value = document.defaultView ;
console.log( value ) ;
document.body.appendChild( document.createTextNode( value ) ) ;
</script>
</body>
</html>
サポート状況
Chrome | Firefox | Safari | Edge | IE | Opera | iOS Safari | Android |
---|---|---|---|---|---|---|---|
● | ● | ● | ● | ● 9+ | ● | ● | ● |
関連記事
- Document()
- Document()は、Documentのコンストラクタです。新しいオブジェクトを作成します。
- Window.frameElement
- frameElementは、Windowのプロパティです。自身を開いている元のフレーム要素を返します。例えば、Aがiframe要素でBを開いている場合、BのframeElementはAのiframe要素です。
- Document.visibilityState
- visibilityStateは、Documentのプロパティです。最上位のブラウジングコンテキストが持つドキュメントの表示状態を文字列で返します。
- Document.activeElement
- activeElementは、Documentのプロパティです。フォーカス中の要素を返します。フォーカス中の要素がなければbody要素、それもなければhtml要素、それもなければnullを返します。