Document.defaultView

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.defaultView 屬性會指向一個目前 document 所屬的 window 物件,若無則為 null

語法

var win = document.defaultView;

此為唯讀屬性。

規範

Specification
HTML
# dom-document-defaultview-dev

瀏覽器相容性

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
defaultView

Legend

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

Full support
Full support