Window
Module: JavaScript DOM API
The window of the view and the global object in the scripting environment.
#include <Window.idl>
Inherits from EventTarget
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| void | scrollBy(optional long x, optional long y) Scrolls the document in the window by the given amount. |
| void | scrollTo(optional long x, optional long y) Scrolls to a particular set of coordinates in the document. |
| unsigned long | setTimeout(AnyCallbackTraced handler, optional long timeout) schedule a callback to be executed after timeout milliseconds |
| void | clearTimeout(unsigned long handle) clear a previous scheduled timer |
| unsigned long | setInterval(AnyCallbackTraced handler, optional long interval) schedule a callback to be executed at timeout milliseconds intervals |
| void | clearInterval(unsigned long handle) clear a previous scheduled repeating timer |
| CSSStyleDeclaration | getComputedStyle(Element element) the last computed style of the element |
| long | requestAnimationFrame(AnyCallbackTraced callback) |
| void | cancelAnimationFrame(long id) Cancels an animation frame request previously scheduled through a call to requestAnimationFrame() |
| void | addEventListener(DOMInternedString type, EventListener listener, optional AddEventListenerOptions options) |
| void | removeEventListener(DOMInternedString type, EventListener listener, optional RemoveEventListenerOptions useCapture) |
| void | queueMicrotask(AnyCallbackTraced callback) Schedules a call to the specified callback after the function that enqueues the microtask has finished. |
| boolean | dispatchEvent(Event event) |
| Selection | getSelection() Returns a Selection object representing the range of text selected by the user, or the current position of the caret. |
Public Attributes
Section titled “Public Attributes”| Name | |
|---|---|
| readonly attribute Document | document The document in the current window. |
| readonly attribute Console | console The console API that can be used for logging. |
| readonly attribute CoherentDebug | cohDebug The Coherent Debug object used to control various CoHTML options. |
| readonly attribute Performance | performance |
| readonly attribute Location | location |
| readonly attribute Navigator | navigator |
| readonly attribute Window | self |
| readonly attribute Storage | localStorage |
| readonly attribute History | history |
| readonly attribute Window | parent A reference to the parent of the current window or subframe. |
| readonly attribute Screen | screen |
| readonly attribute CustomElementRegistry | customElements Gets the CustomElementRegistry that can be used to register new custom or get information about registered custom elements. |
| readonly attribute long | outerHeight Gets the height in pixels of the whole browser window. It represents the height of the whole browser window including sidebar (if expanded), window chrome and window resizing borders/handles. |
| readonly attribute long | outerWidth Gets the width of the outside of the browser window. It represents the width of the whole browser window including sidebar (if expanded), window chrome and window resizing borders/handles. |
| readonly attribute long | innerHeight Height (in pixels) of the browser window viewport including, if rendered, the horizontal scrollbar. |
| readonly attribute long | innerWidth Width (in pixels) of the browser window viewport including, if rendered, the vertical scrollbar. |
| readonly attribute long | screenX Returns the horizontal distance, in CSS pixels, of the left border of the user’s browser from the left side of the screen. |
| readonly attribute long | screenY Returns the vertical distance, in CSS pixels of the top border of the user’s browser from the top edge of the screen. |
| readonly attribute long | screenLeft This is an alias for screenX. |
| readonly attribute long | screenTop This is an alias for screenY. |
| readonly attribute long | scrollX Returns the number of pixels that the document has already been scrolled horizontally. |
| readonly attribute long | scrollY Returns the number of pixels that the document has already been scrolled vertically. |
| readonly attribute long | pageXOffset This is an alias for scrollX. |
| readonly attribute long | pageYOffset This is an alias for scrollY. |
| readonly attribute double | devicePixelRatio Returns the ratio of the CSS pixel size to device pixel size. |
| readonly attribute Chrome | chrome |
| attribute EventSetter | gamepadconnected |
| attribute EventSetter | gamepaddisconnected |
| attribute EventSetter | popstate |
| attribute EventSetter | resize |
| attribute EventSetter | unhandledrejection |
| attribute EventSetter | abort |
| attribute EventSetter | blur |
| attribute EventSetter | click |
| attribute EventSetter | auxclick |
| attribute EventSetter | dblclick |
| attribute EventSetter | error |
| attribute EventSetter | focus |
| attribute EventSetter | keydown |
| attribute EventSetter | keypress |
| attribute EventSetter | keyup |
| attribute EventSetter | load |
| attribute EventSetter | mousedown |
| attribute EventSetter | mouseover |
| attribute EventSetter | mouseout |
| attribute EventSetter | mouseenter |
| attribute EventSetter | mouseleave |
| attribute EventSetter | mousemove |
| attribute EventSetter | mouseup |
| attribute EventSetter | input |
| attribute EventSetter | scroll |
| attribute EventSetter | wheel |
| attribute EventSetter | touchstart |
| attribute EventSetter | touchend |
| attribute EventSetter | touchmove |
Public Functions Documentation
Section titled “Public Functions Documentation”function scrollBy
Section titled “function scrollBy”void scrollBy( optional long x, optional long y)Scrolls the document in the window by the given amount.
Parameters:
- x offset in pixels to scroll horizontally.
- y offset in pixels to scroll vertically.
function scrollTo
Section titled “function scrollTo”void scrollTo( optional long x, optional long y)Scrolls to a particular set of coordinates in the document.
Parameters:
- x is the pixel along the horizontal axis of the document that you want displayed in the upper left.
- y is the pixel along the vertical axis of the document that you want displayed in the upper left.
function setTimeout
Section titled “function setTimeout”unsigned long setTimeout( AnyCallbackTraced handler, optional long timeout)schedule a callback to be executed after timeout milliseconds
Parameters:
- handler a callback without arguments
- timeout the delay in milliseconds.
Return: a handle to the scheduled timer
Note: A 0 delay makes the callback to be executed on the next frame
function clearTimeout
Section titled “function clearTimeout”void clearTimeout( unsigned long handle)clear a previous scheduled timer
Parameters:
- handle a handle returned from setTimeout
function setInterval
Section titled “function setInterval”unsigned long setInterval( AnyCallbackTraced handler, optional long interval)schedule a callback to be executed at timeout milliseconds intervals
Parameters:
- handler a callback without arguments
- interval the delay in milliseconds.
Return: a handle to the scheduled timer
Note: A 0 delay makes the callback to be executed on the next frame
The first call to the callback will be after timeout milliseconds
function clearInterval
Section titled “function clearInterval”void clearInterval( unsigned long handle)clear a previous scheduled repeating timer
Parameters:
- handle a handle returned from setInterval
function getComputedStyle
Section titled “function getComputedStyle”CSSStyleDeclaration getComputedStyle( Element element)the last computed style of the element
Parameters:
- element the element whose style to get
function requestAnimationFrame
Section titled “function requestAnimationFrame”long requestAnimationFrame( AnyCallbackTraced callback)function cancelAnimationFrame
Section titled “function cancelAnimationFrame”void cancelAnimationFrame( long id)Cancels an animation frame request previously scheduled through a call to requestAnimationFrame()
Parameters:
- id The ID of the request to cancel.
function addEventListener
Section titled “function addEventListener”void addEventListener( DOMInternedString type, EventListener listener, optional AddEventListenerOptions options)Reimplements: EventTarget::addEventListener
function removeEventListener
Section titled “function removeEventListener”void removeEventListener( DOMInternedString type, EventListener listener, optional RemoveEventListenerOptions useCapture)Reimplements: EventTarget::removeEventListener
function queueMicrotask
Section titled “function queueMicrotask”void queueMicrotask( AnyCallbackTraced callback)Schedules a call to the specified callback after the function that enqueues the microtask has finished.
Parameters:
- callback The callback to be invoked.
function dispatchEvent
Section titled “function dispatchEvent”boolean dispatchEvent( Event event)Reimplements: EventTarget::dispatchEvent
function getSelection
Section titled “function getSelection”Selection getSelection()Returns a Selection object representing the range of text selected by the user, or the current position of the caret.
Public Attributes Documentation
Section titled “Public Attributes Documentation”variable document
Section titled “variable document”readonly attribute Document document;The document in the current window.
variable console
Section titled “variable console”readonly attribute Console console;The console API that can be used for logging.
variable cohDebug
Section titled “variable cohDebug”readonly attribute CoherentDebug cohDebug;The Coherent Debug object used to control various CoHTML options.
variable performance
Section titled “variable performance”readonly attribute Performance performance;variable location
Section titled “variable location”readonly attribute Location location;variable navigator
Section titled “variable navigator”readonly attribute Navigator navigator;variable self
Section titled “variable self”readonly attribute Window self;variable localStorage
Section titled “variable localStorage”readonly attribute Storage localStorage;variable history
Section titled “variable history”readonly attribute History history;variable parent
Section titled “variable parent”readonly attribute Window parent;A reference to the parent of the current window or subframe.
Note: If a window does not have a parent, its parent property is a reference to itself.
variable screen
Section titled “variable screen”readonly attribute Screen screen;variable customElements
Section titled “variable customElements”readonly attribute CustomElementRegistry customElements;Gets the CustomElementRegistry that can be used to register new custom or get information about registered custom elements.
variable outerHeight
Section titled “variable outerHeight”readonly attribute long outerHeight;Gets the height in pixels of the whole browser window. It represents the height of the whole browser window including sidebar (if expanded), window chrome and window resizing borders/handles.
variable outerWidth
Section titled “variable outerWidth”readonly attribute long outerWidth;Gets the width of the outside of the browser window. It represents the width of the whole browser window including sidebar (if expanded), window chrome and window resizing borders/handles.
variable innerHeight
Section titled “variable innerHeight”readonly attribute long innerHeight;Height (in pixels) of the browser window viewport including, if rendered, the horizontal scrollbar.
variable innerWidth
Section titled “variable innerWidth”readonly attribute long innerWidth;Width (in pixels) of the browser window viewport including, if rendered, the vertical scrollbar.
variable screenX
Section titled “variable screenX”readonly attribute long screenX;Returns the horizontal distance, in CSS pixels, of the left border of the user’s browser from the left side of the screen.
variable screenY
Section titled “variable screenY”readonly attribute long screenY;Returns the vertical distance, in CSS pixels of the top border of the user’s browser from the top edge of the screen.
variable screenLeft
Section titled “variable screenLeft”readonly attribute long screenLeft;This is an alias for screenX.
variable screenTop
Section titled “variable screenTop”readonly attribute long screenTop;This is an alias for screenY.
variable scrollX
Section titled “variable scrollX”readonly attribute long scrollX;Returns the number of pixels that the document has already been scrolled horizontally.
variable scrollY
Section titled “variable scrollY”readonly attribute long scrollY;Returns the number of pixels that the document has already been scrolled vertically.
variable pageXOffset
Section titled “variable pageXOffset”readonly attribute long pageXOffset;This is an alias for scrollX.
variable pageYOffset
Section titled “variable pageYOffset”readonly attribute long pageYOffset;This is an alias for scrollY.
variable devicePixelRatio
Section titled “variable devicePixelRatio”readonly attribute double devicePixelRatio;Returns the ratio of the CSS pixel size to device pixel size.
variable chrome
Section titled “variable chrome”readonly attribute Chrome chrome;variable gamepadconnected
Section titled “variable gamepadconnected”attribute EventSetter gamepadconnected;variable gamepaddisconnected
Section titled “variable gamepaddisconnected”attribute EventSetter gamepaddisconnected;variable popstate
Section titled “variable popstate”attribute EventSetter popstate;variable resize
Section titled “variable resize”attribute EventSetter resize;variable unhandledrejection
Section titled “variable unhandledrejection”attribute EventSetter unhandledrejection;variable abort
Section titled “variable abort”attribute EventSetter abort;variable blur
Section titled “variable blur”attribute EventSetter blur;variable click
Section titled “variable click”attribute EventSetter click;variable auxclick
Section titled “variable auxclick”attribute EventSetter auxclick;variable dblclick
Section titled “variable dblclick”attribute EventSetter dblclick;variable error
Section titled “variable error”attribute EventSetter error;variable focus
Section titled “variable focus”attribute EventSetter focus;variable keydown
Section titled “variable keydown”attribute EventSetter keydown;variable keypress
Section titled “variable keypress”attribute EventSetter keypress;variable keyup
Section titled “variable keyup”attribute EventSetter keyup;variable load
Section titled “variable load”attribute EventSetter load;variable mousedown
Section titled “variable mousedown”attribute EventSetter mousedown;variable mouseover
Section titled “variable mouseover”attribute EventSetter mouseover;variable mouseout
Section titled “variable mouseout”attribute EventSetter mouseout;variable mouseenter
Section titled “variable mouseenter”attribute EventSetter mouseenter;variable mouseleave
Section titled “variable mouseleave”attribute EventSetter mouseleave;variable mousemove
Section titled “variable mousemove”attribute EventSetter mousemove;variable mouseup
Section titled “variable mouseup”attribute EventSetter mouseup;variable input
Section titled “variable input”attribute EventSetter input;variable scroll
Section titled “variable scroll”attribute EventSetter scroll;variable wheel
Section titled “variable wheel”attribute EventSetter wheel;variable touchstart
Section titled “variable touchstart”attribute EventSetter touchstart;variable touchend
Section titled “variable touchend”attribute EventSetter touchend;variable touchmove
Section titled “variable touchmove”attribute EventSetter touchmove;© 2026 Coherent Labs. All rights reserved.