Javascript Window - 31 Properties (Reference)
Window Object in Javascript is a global object that is available in all web pages. This window object properties to access the global information.
Window Properties:
self
It returns the window itself.
var x = window.self;
// Window {window: Window, self: Window, document: document, name: "", location: Location, …}
window
It returns the window itself.
var x = window.window;
// Window {window: Window, self: Window, document: document, name: "", location: Location, …}
frames
It returns the window itself.
var x = window.frames;
// Window {window: Window, self: Window, document: document, name: "", location: Location, …}
parent
It is the reference to the parent of the current window or subframe. If no parent, it is a reference to itself.
var x = window.parent;
// Window {window: Window, self: Window, document: document, name: "", location: Location, …}
top
It is the reference to the topmost window in the window hierarchy.
var x = window.top;
// Window {window: Window, self: Window, document: document, name: "", location: Location, …}
length
It returns the length of frames in the window.
var x = window.length;
// 0
innerHeight
It is the height of the content area of the browser window including, if rendered, the horizontal scrollbar.
var x = window.innerHeight;
// 798
// read only
innerWidth
It is the width of the content area of the browser window including, if rendered, the vertical scrollbar.
var x = window.innerWidth;
// 1389
// read only
outerHeight
It returns the height of the outside of the browser window.
var x = window.outerHeight;
// 877
// read only
outerWidth
It returns the height of the outside of the browser window.
var x = window.outerWidth;
// 1389
// read only
scrollX
It returns the number of pixels that the document is currently scrolled horizontally.
var x = window.scrollX;
// read only
scrollY
It returns the number of pixels that the document is currently scrolled vertically.
var x = window.scrollY;
// read only
pageXOffset
It returns the number of pixels that the document is currently scrolled horizontally.
var x = window.pageXOffset;
// read only
pageYOffset
It returns the number of pixels that the document is currently scrolled vertically.
var x = window.pageYOffset;
// read only
screenX
It returns the horizontal distance, in CSS pixels. It is the left border of the browser to the left side of the screen.
var x = window.screenX;
// 0
screenLeft
It returns the horizontal distance, in CSS pixels. It is the left border of the browser to the left side of the screen.
var x = window.screenLeft;
// 0
screenY
It returns the horizontal distance, in CSS pixels. It is the left border of the browser to the left side of the screen.
var x = window.screenY;
// 0
screenTop
It returns the vertical distance, in CSS pixels. It is the left border of the browser to the left side of the screen.
var x = window.screenTop;
// 0
locationbar
It returns the locationbar object, whose visibility can be checked.
var x = window.locationbar;
// BarProp {visible: true}
menubar
It returns the menubar object, whose visibility can be checked.
var x = window.menubar;
// BarProp {visible: true}
personalbar
It returns the personalbar object, whose visibility can be checked.
var x = window.personalbar;
// BarProp {visible: true}
scrollbars
It returns the scrollbars object, whose visibility can be checked.
var x = window.scrollbars;
// BarProp {visible: true}
statusbar
It returns the statusbar object, whose visibility can be toggled.
var x = window.statusbar;
// BarProp {visible: true}
toolbar
It returns the toolbar object, whose visibility can be toggled.
var x = window.toolbar;
// BarProp {visible: true}
name
It gets/sets the name of the window's browsing context.
window.name = "Some name";
var x = window.name;
opener
It returns a reference to the window that opened the window.
var x = window.opener;
// null
// can be omitted by
// target=noopener on a link
// passing noopener in the open()
devicePixelRatio
It returns the ratio of the device's screen's width to its CSS pixels.
var x = window.devicePixelRatio;
// 2
caches
It returns the CacheStorage object associated with the current context.
var x = window.caches;
// CacheStorage {}
indexedDB
It returns an IDBFactory object.
var x = window.indexedDB;
// IDBFactory {}
isSecureContext
It returns an IDBFactory object.
var x = window.indexedDB;
// IDBFactory {}
origin
It returns the origin of the global scope, serialized as a string.
var x = window.origin;
//"null"
