In browsers, document.defaultView returns the window object associated with a document, or null if none is available.

Syntax

var win = document.defaultView;

This property is read-only.

Events

popstate
Fired when the active history entry changes.
resize
Fired when the document view (window) has been resized.
storage
Fired when a storage area (localStorage or sessionStorage) has been modified in the context of another document.

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'Document.defaultView' in that specification.
Living Standard No change
HTML5
The definition of 'Document.defaultView' in that specification.
Recommendation Initial definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
defaultViewChrome Full support 1Edge Full support 12Firefox Full support YesIE Full support 9Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android Full support YesOpera Android ? Safari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

Document Tags and Contributors

Last updated by: irenesmith,