HTML DOM Document defaultView property
- Previous Page createTextNode()
- Next Page designMode
- Go to the Previous Level HTML DOM Documents
Instance
Example 1
Get the window object of the document:
const view = document.defaultView;
Example 2
Get the window size:
const view = document.defaultView; let width = view.innerWidth; let height = view.innerHeight;
Syntax
document.defaultView
Return value
Type | Description |
---|---|
Object | The window object of the document. |
Browser support
document.defaultView
It is a feature of DOM Level 1 (1998).
All browsers support it:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Support | 9-11 | Support | Support | Support | Support |
- Previous Page createTextNode()
- Next Page designMode
- Go to the Previous Level HTML DOM Documents