Skip to content
SiteEmail

Window

Module: JavaScript DOM API

The window of the view and the global object in the scripting environment.

#include <Window.idl>

Inherits from EventTarget

Name
voidscrollBy(optional long x, optional long y)
Scrolls the document in the window by the given amount.
voidscrollTo(optional long x, optional long y)
Scrolls to a particular set of coordinates in the document.
unsigned longsetTimeout(AnyCallbackTraced handler, optional long timeout)
schedule a callback to be executed after timeout milliseconds
voidclearTimeout(unsigned long handle)
clear a previous scheduled timer
unsigned longsetInterval(AnyCallbackTraced handler, optional long interval)
schedule a callback to be executed at timeout milliseconds intervals
voidclearInterval(unsigned long handle)
clear a previous scheduled repeating timer
CSSStyleDeclarationgetComputedStyle(Element element)
the last computed style of the element
longrequestAnimationFrame(AnyCallbackTraced callback)
voidcancelAnimationFrame(long id)
Cancels an animation frame request previously scheduled through a call to requestAnimationFrame()
voidaddEventListener(DOMInternedString type, EventListener listener, optional AddEventListenerOptions options)
voidremoveEventListener(DOMInternedString type, EventListener listener, optional RemoveEventListenerOptions useCapture)
voidqueueMicrotask(AnyCallbackTraced callback)
Schedules a call to the specified callback after the function that enqueues the microtask has finished.
booleandispatchEvent(Event event)
SelectiongetSelection()
Returns a Selection object representing the range of text selected by the user, or the current position of the caret.
Name
readonly attribute Documentdocument
The document in the current window.
readonly attribute Consoleconsole
The console API that can be used for logging.
readonly attribute CoherentDebugcohDebug
The Coherent Debug object used to control various CoHTML options.
readonly attribute Performanceperformance
readonly attribute Locationlocation
readonly attribute Navigatornavigator
readonly attribute Windowself
readonly attribute StoragelocalStorage
readonly attribute Historyhistory
readonly attribute Windowparent
A reference to the parent of the current window or subframe.
readonly attribute Screenscreen
readonly attribute CustomElementRegistrycustomElements
Gets the CustomElementRegistry that can be used to register new custom or get information about registered custom elements.
readonly attribute longouterHeight
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 longouterWidth
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 longinnerHeight
Height (in pixels) of the browser window viewport including, if rendered, the horizontal scrollbar.
readonly attribute longinnerWidth
Width (in pixels) of the browser window viewport including, if rendered, the vertical scrollbar.
readonly attribute longscreenX
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 longscreenY
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 longscreenLeft
This is an alias for screenX.
readonly attribute longscreenTop
This is an alias for screenY.
readonly attribute longscrollX
Returns the number of pixels that the document has already been scrolled horizontally.
readonly attribute longscrollY
Returns the number of pixels that the document has already been scrolled vertically.
readonly attribute longpageXOffset
This is an alias for scrollX.
readonly attribute longpageYOffset
This is an alias for scrollY.
readonly attribute doubledevicePixelRatio
Returns the ratio of the CSS pixel size to device pixel size.
readonly attribute Chromechrome
attribute EventSettergamepadconnected
attribute EventSettergamepaddisconnected
attribute EventSetterpopstate
attribute EventSetterresize
attribute EventSetterunhandledrejection
attribute EventSetterabort
attribute EventSetterblur
attribute EventSetterclick
attribute EventSetterauxclick
attribute EventSetterdblclick
attribute EventSettererror
attribute EventSetterfocus
attribute EventSetterkeydown
attribute EventSetterkeypress
attribute EventSetterkeyup
attribute EventSetterload
attribute EventSettermousedown
attribute EventSettermouseover
attribute EventSettermouseout
attribute EventSettermouseenter
attribute EventSettermouseleave
attribute EventSettermousemove
attribute EventSettermouseup
attribute EventSetterinput
attribute EventSetterscroll
attribute EventSetterwheel
attribute EventSettertouchstart
attribute EventSettertouchend
attribute EventSettertouchmove
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.
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.
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

void clearTimeout(
unsigned long handle
)

clear a previous scheduled timer

Parameters:

  • handle a handle returned from setTimeout
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

void clearInterval(
unsigned long handle
)

clear a previous scheduled repeating timer

Parameters:

  • handle a handle returned from setInterval
CSSStyleDeclaration getComputedStyle(
Element element
)

the last computed style of the element

Parameters:

  • element the element whose style to get
long requestAnimationFrame(
AnyCallbackTraced callback
)
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.
void addEventListener(
DOMInternedString type,
EventListener listener,
optional AddEventListenerOptions options
)

Reimplements: EventTarget::addEventListener

void removeEventListener(
DOMInternedString type,
EventListener listener,
optional RemoveEventListenerOptions useCapture
)

Reimplements: EventTarget::removeEventListener

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.
boolean dispatchEvent(
Event event
)

Reimplements: EventTarget::dispatchEvent

Selection getSelection()

Returns a Selection object representing the range of text selected by the user, or the current position of the caret.

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.

Note: If a window does not have a parent, its parent property is a reference to itself.

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;