HTML DOM Document defaultView attribute

definition and usage

defaultView attribute returns the document's Kware Window Object.

see also:

Kware Window Object

instance

Example 1

get document's window object:

const view = document.defaultView;

try it yourself

Example 2

get window size:

const view = document.defaultView;
let width = view.innerWidth;
let height = view.innerHeight;

try it yourself

syntax

document.defaultView

return value

type description
object document's window object.

browser support

document.defaultView ya ce ce DOM Level 1 (1998) teyari.

所有浏览器都支持它:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
支持 9-11 支持 支持 支持 支持