dart:html
Window class
Top-level container for the current browser tab or window.
In a web browser, each window has a Window object, but within the context of a script, this object represents only the current window. Each other window, tab, and iframe has its own Window object.
Each window contains a Document object, which contains all of the window's content.
Use the top-level window
object to access the current window. For example:
// Draw a scene when the window repaints.
drawScene(num delta) {...}
window.animationFrame.then(drawScene);.
// Write to the console.
window.console.log('Jinkies!');
window.console.error('Jeepers!');
Note: This class represents only the current window, while WindowBase is a representation of any window, including other tabs, windows, and frames.
See also
Other resources
- Inheritance
- Implements
-
- Annotations
- @Native("Window,DOMWindow")
Properties
- animationFrame → Future<num>
read-only
- Returns a Future that completes just before the window is about to repaint so the user can draw an animation frame. [...]
- animationWorklet → _Worklet
final
- applicationCache → ApplicationCache
final
- The application cache for this window. [...]
- audioWorklet → _Worklet
final
- caches → CacheStorage
final
- closed → bool
final
- console → Console
read-only
- The debugging console for this window.
- cookieStore → CookieStore
final
- crypto → Crypto
final
- Entrypoint for the browser's cryptographic functions. [...]
- customElements → CustomElementRegistry
final
- defaultStatus ↔ String
read / write
- Deprecated*.
- defaultstatus ↔ String
read / write
- Deprecated*.
- devicePixelRatio → num
final
- The ratio between physical pixels and logical CSS pixels. [...]
- document → Document
read-only
- The newest document in this window. [...]
- external → External
final
- history → History
final
- The current session history for this window's newest document. [...]
- indexedDB → IdbFactory
@SupportedBrowser(SupportedBrowser.CHROME, '23.0'), @SupportedBrowser(SupportedBrowser.FIREFOX, '15.0'), @SupportedBrowser(SupportedBrowser.IE, '10.0'), read-only
- Gets an instance of the Indexed DB factory to being using Indexed DB. [...]
- innerHeight → int
final
- The height of the viewport including scrollbars. [...]
- innerWidth → int
final
- The width of the viewport including scrollbars. [...]
- isSecureContext → bool
final
- localStorage → Storage
final
- Storage for this window that persists across sessions. [...]
- location ↔ Location
read / write
- The current location of this window. [...]
- locationbar → BarProp
final
- This window's location bar, which displays the URL. [...]
- This window's menu bar, which displays menu commands. [...]
- name ↔ String
read / write
- The name of this window. [...]
- navigator → Navigator
final
- The user agent accessing this window. [...]
- offscreenBuffering → bool
final
- Whether objects are drawn offscreen before being displayed. [...]
- onAbort → Stream<Event>
read-only
- Stream of
abort
events handled by this Window. - onAnimationEnd → Stream<AnimationEvent>
read-only
- Stream of
animationend
events handled by this Window. - onAnimationIteration → Stream<AnimationEvent>
read-only
- Stream of
animationiteration
events handled by this Window. - onAnimationStart → Stream<AnimationEvent>
read-only
- Stream of
animationstart
events handled by this Window. - onBeforeUnload → Stream<Event>
read-only
- Stream of
beforeunload
events handled by this Window. - onBlur → Stream<Event>
read-only
- Stream of
blur
events handled by this Window. - onCanPlay → Stream<Event>
read-only
- onCanPlayThrough → Stream<Event>
read-only
- onChange → Stream<Event>
read-only
- Stream of
change
events handled by this Window. - onClick → Stream<MouseEvent>
read-only
- Stream of
click
events handled by this Window. - onContentLoaded → Stream<Event>
read-only
- Stream of
contentloaded
events handled by this Window. - Stream of
contextmenu
events handled by this Window. - onDeviceMotion → Stream<DeviceMotionEvent>
read-only
- Stream of
devicemotion
events handled by this Window. - onDeviceOrientation → Stream<DeviceOrientationEvent>
read-only
- Stream of
deviceorientation
events handled by this Window. - onDoubleClick → Stream<Event>
read-only
- Stream of
doubleclick
events handled by this Window. - onDrag → Stream<MouseEvent>
read-only
- Stream of
drag
events handled by this Window. - onDragEnd → Stream<MouseEvent>
read-only
- Stream of
dragend
events handled by this Window. - onDragEnter → Stream<MouseEvent>
read-only
- Stream of
dragenter
events handled by this Window. - onDragLeave → Stream<MouseEvent>
read-only
- Stream of
dragleave
events handled by this Window. - onDragOver → Stream<MouseEvent>
read-only
- Stream of
dragover
events handled by this Window. - onDragStart → Stream<MouseEvent>
read-only
- Stream of
dragstart
events handled by this Window. - onDrop → Stream<MouseEvent>
read-only
- Stream of
drop
events handled by this Window. - onDurationChange → Stream<Event>
read-only
- onEmptied → Stream<Event>
read-only
- onEnded → Stream<Event>
read-only
- onError → Stream<Event>
read-only
- Stream of
error
events handled by this Window. - onFocus → Stream<Event>
read-only
- Stream of
focus
events handled by this Window. - onHashChange → Stream<Event>
read-only
- Stream of
hashchange
events handled by this Window. - onInput → Stream<Event>
read-only
- Stream of
input
events handled by this Window. - onInvalid → Stream<Event>
read-only
- Stream of
invalid
events handled by this Window. - onKeyDown → Stream<KeyboardEvent>
read-only
- Stream of
keydown
events handled by this Window. - onKeyPress → Stream<KeyboardEvent>
read-only
- Stream of
keypress
events handled by this Window. - onKeyUp → Stream<KeyboardEvent>
read-only
- Stream of
keyup
events handled by this Window. - onLoad → Stream<Event>
read-only
- Stream of
load
events handled by this Window. - onLoadedData → Stream<Event>
read-only
- onLoadedMetadata → Stream<Event>
read-only
- onLoadStart → Stream<Event>
read-only
- onMessage → Stream<MessageEvent>
read-only
- Stream of
message
events handled by this Window. - onMouseDown → Stream<MouseEvent>
read-only
- Stream of
mousedown
events handled by this Window. - onMouseEnter → Stream<MouseEvent>
read-only
- Stream of
mouseenter
events handled by this Window. - onMouseLeave → Stream<MouseEvent>
read-only
- Stream of
mouseleave
events handled by this Window. - onMouseMove → Stream<MouseEvent>
read-only
- Stream of
mousemove
events handled by this Window. - onMouseOut → Stream<MouseEvent>
read-only
- Stream of
mouseout
events handled by this Window. - onMouseOver → Stream<MouseEvent>
read-only
- Stream of
mouseover
events handled by this Window. - onMouseUp → Stream<MouseEvent>
read-only
- Stream of
mouseup
events handled by this Window. - onMouseWheel → Stream<WheelEvent>
read-only
- Stream of
mousewheel
events handled by this Window. - onOffline → Stream<Event>
read-only
- Stream of
offline
events handled by this Window. - onOnline → Stream<Event>
read-only
- Stream of
online
events handled by this Window. - onPageHide → Stream<Event>
read-only
- Stream of
pagehide
events handled by this Window. - onPageShow → Stream<Event>
read-only
- Stream of
pageshow
events handled by this Window. - onPause → Stream<Event>
read-only
- onPlay → Stream<Event>
read-only
- onPlaying → Stream<Event>
read-only
- onPopState → Stream<PopStateEvent>
read-only
- Stream of
popstate
events handled by this Window. - onProgress → Stream<Event>
read-only
- onRateChange → Stream<Event>
read-only
- onReset → Stream<Event>
read-only
- Stream of
reset
events handled by this Window. - onResize → Stream<Event>
read-only
- Stream of
resize
events handled by this Window. - onScroll → Stream<Event>
read-only
- Stream of
scroll
events handled by this Window. - onSearch → Stream<Event>
read-only
- Stream of
search
events handled by this Window. - onSeeked → Stream<Event>
read-only
- onSeeking → Stream<Event>
read-only
- onSelect → Stream<Event>
read-only
- Stream of
select
events handled by this Window. - onStalled → Stream<Event>
read-only
- onStorage → Stream<StorageEvent>
read-only
- Stream of
storage
events handled by this Window. - onSubmit → Stream<Event>
read-only
- Stream of
submit
events handled by this Window. - onSuspend → Stream<Event>
read-only
- onTimeUpdate → Stream<Event>
read-only
- onTouchCancel → Stream<TouchEvent>
read-only
- Stream of
touchcancel
events handled by this Window. - onTouchEnd → Stream<TouchEvent>
read-only
- Stream of
touchend
events handled by this Window. - onTouchMove → Stream<TouchEvent>
read-only
- Stream of
touchmove
events handled by this Window. - onTouchStart → Stream<TouchEvent>
read-only
- Stream of
touchstart
events handled by this Window. - onTransitionEnd → Stream<TransitionEvent>
read-only
- Stream of
transitionend
events handled by this Window. - onUnload → Stream<Event>
read-only
- Stream of
unload
events handled by this Window. - onVolumeChange → Stream<Event>
read-only
- onWaiting → Stream<Event>
read-only
- onWheel → Stream<WheelEvent>
read-only
- Stream of
wheel
events handled by this Window. - opener ↔ WindowBase
read / write
- A reference to the window that opened this one. [...]
- orientation → int
final
- origin → String
final
- outerHeight → int
final
- The height of this window including all user interface elements. [...]
- outerWidth → int
final
- The width of the window including all user interface elements. [...]
- pageXOffset → int
read-only
- pageYOffset → int
read-only
- parent → WindowBase
read-only
- A reference to the parent of this window. [...]
- performance → Performance
@SupportedBrowser(SupportedBrowser.CHROME), @SupportedBrowser(SupportedBrowser.FIREFOX), @SupportedBrowser(SupportedBrowser.IE), final
- Timing and navigation data for this window. [...]
- screen → Screen
final
- Information about the screen displaying this window. [...]
- screenLeft → int
final
- The distance from the left side of the screen to the left side of this window. [...]
- screenTop → int
final
- The distance from the top of the screen to the top of this window. [...]
- screenX → int
final
- The distance from the left side of the screen to the mouse pointer. [...]
- screenY → int
final
- The distance from the top of the screen to the mouse pointer. [...]
- scrollbars → BarProp
final
- This window's scroll bars. [...]
- scrollX → int
read-only
- The distance this window has been scrolled horizontally. [...]
- scrollY → int
read-only
- The distance this window has been scrolled vertically. [...]
- self → WindowBase
read-only
- The current window. [...]
- sessionStorage → Storage
final
- Storage for this window that is cleared when this session ends. [...]
- speechSynthesis → SpeechSynthesis
final
- Access to speech synthesis in the browser. [...]
- status ↔ String
read / write
- Deprecated*.
- statusbar → BarProp
final
- This window's status bar. [...]
- styleMedia → StyleMedia
final
- Access to CSS media queries. [...]
- toolbar → BarProp
final
- This window's tool bar. [...]
- top → WindowBase
read-only
- A reference to the topmost window in the window hierarchy. [...]
- visualViewport → VisualViewport
final
- window → WindowBase
read-only
- The current window. [...]
- hashCode → int
read-only, inherited
- The hash code for this object. [...]
- on → Events
read-only, inherited
- This is an ease-of-use accessor for event streams which should only be used when an explicit accessor is not available.
- runtimeType → Type
read-only, inherited
- A representation of the runtime type of the object.
Methods
- alert([String message ]) → void
- Displays a modal alert to the user. [...]
- atob(String atob) → String
- btoa(String btoa) → String
- cancelAnimationFrame(int id) → void
- Cancels an animation frame request. [...]
- cancelIdleCallback(int handle) → void
- close() → void
- Closes the window. [...]
- confirm([String message ]) → bool
- Displays a modal OK/Cancel prompt to the user. [...]
- fetch(dynamic input, [ Map init ]) → Future
- find(String string, bool caseSensitive, bool backwards, bool wrap, bool wholeWord, bool searchInFrames, bool showDialog) → bool
- Finds text in this window. [...]
- getComputedStyleMap(Element element, String pseudoElement) → StylePropertyMapReadonly
- getMatchedCssRules(Element element, String pseudoElement) → List<CssRule>
@Creates('_CssRuleList'), @JSName('getMatchedCSSRules'), @Returns('_CssRuleList|Null')
- Returns all CSS rules that apply to the element's pseudo-element.
- getSelection() → Selection
- Returns the currently selected text. [...]
- matchMedia(String query) → MediaQueryList
- Returns a list of media queries for the given query string. [...]
- moveBy(int x, int y) → void
- Moves this window. [...]
- moveTo(Point<num> p) → void
- Moves this window to a specific position. [...]
- open(String url, String name, [ String options ]) → WindowBase
- Opens a new window. [...]
- openDatabase(String name, String version, String displayName, int estimatedSize, [ DatabaseCallback creationCallback ]) → SqlDatabase
@Creates('SqlDatabase'), @JSName('openDatabase'), @SupportedBrowser(SupportedBrowser.CHROME), @SupportedBrowser(SupportedBrowser.SAFARI)
- postMessage(dynamic message, String targetOrigin, [ List<Object> transfer ]) → void
- Sends a cross-origin message. [...]
- print() → void
- Opens the print dialog for this window. [...]
- requestAnimationFrame(FrameRequestCallback callback) → int
- Called to draw an animation frame and then request the window to repaint after
callback
has finished (creating the animation). [...] - requestFileSystem(int size, { bool persistent: false }) → Future<FileSystem>
- Access a sandboxed file system of
size
bytes. [...] - requestIdleCallback(IdleRequestCallback callback, [ Map options ]) → int
- resizeBy(int x, int y) → void
- Resizes this window by an offset. [...]
- resizeTo(int x, int y) → void
- Resizes this window to a specific width and height. [...]
- resolveLocalFileSystemUrl(String url) → Future<Entry>
@JSName('webkitResolveLocalFileSystemURL'), @SupportedBrowser(SupportedBrowser.CHROME)
- Asynchronously retrieves a local filesystem entry. [...]
- scroll([dynamic options_OR_x, dynamic y, Map scrollOptions ]) → void
- Scrolls the page horizontally and vertically to a specific point. [...]
- scrollBy([dynamic options_OR_x, dynamic y, Map scrollOptions ]) → void
- Scrolls the page horizontally and vertically by an offset. [...]
- scrollTo([dynamic options_OR_x, dynamic y, Map scrollOptions ]) → void
- Scrolls the page horizontally and vertically to a specific point. [...]
- stop() → void
- Stops the window from loading. [...]
- addEventListener(String type, EventListener listener, [ bool useCapture ]) → void
inherited
- dispatchEvent(Event event) → bool
inherited
- noSuchMethod(Invocation invocation) → dynamic
inherited
- Invoked when a non-existent method or property is accessed. [...]
- removeEventListener(String type, EventListener listener, [ bool useCapture ]) → void
inherited
- toString() → String
inherited
- Returns a string representation of this object.
Operators
- operator ==(dynamic other) → bool
inherited
- The equality operator. [...]
Static Properties
- supportsPointConversions → bool
read-only
- convertPointFromNodeToPage and convertPointFromPageToNode are removed. see http://dev.w3.org/csswg/cssom-view/#geometry
Constants
- animationEndEvent → const EventStreamProvider<AnimationEvent>
@SupportedBrowser(SupportedBrowser.CHROME), @SupportedBrowser(SupportedBrowser.SAFARI)
- Static factory designed to expose
animationend
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<AnimationEvent>('webkitAnimationEnd')
- animationIterationEvent → const EventStreamProvider<AnimationEvent>
@SupportedBrowser(SupportedBrowser.CHROME), @SupportedBrowser(SupportedBrowser.SAFARI)
- Static factory designed to expose
animationiteration
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<AnimationEvent>('webkitAnimationIteration')
- animationStartEvent → const EventStreamProvider<AnimationEvent>
@SupportedBrowser(SupportedBrowser.CHROME), @SupportedBrowser(SupportedBrowser.SAFARI)
- Static factory designed to expose
animationstart
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<AnimationEvent>('webkitAnimationStart')
- beforeUnloadEvent → const EventStreamProvider<BeforeUnloadEvent>
- Static factory designed to expose
beforeunload
events to event handlers that are not necessarily instances of Window
. [...] const _BeforeUnloadEventStreamProvider('beforeunload')
- contentLoadedEvent → const EventStreamProvider<Event>
- Static factory designed to expose
contentloaded
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<Event>('DOMContentLoaded')
- deviceMotionEvent → const EventStreamProvider<DeviceMotionEvent>
- Static factory designed to expose
devicemotion
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<DeviceMotionEvent>('devicemotion')
- deviceOrientationEvent → const EventStreamProvider<DeviceOrientationEvent>
- Static factory designed to expose
deviceorientation
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<DeviceOrientationEvent>('deviceorientation')
- hashChangeEvent → const EventStreamProvider<Event>
- Static factory designed to expose
hashchange
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<Event>('hashchange')
- loadStartEvent → const EventStreamProvider<Event>
-
const EventStreamProvider<Event>('loadstart')
- messageEvent → const EventStreamProvider<MessageEvent>
- Static factory designed to expose
message
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<MessageEvent>('message')
- offlineEvent → const EventStreamProvider<Event>
- Static factory designed to expose
offline
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<Event>('offline')
- onlineEvent → const EventStreamProvider<Event>
- Static factory designed to expose
online
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<Event>('online')
- pageHideEvent → const EventStreamProvider<Event>
- Static factory designed to expose
pagehide
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<Event>('pagehide')
- pageShowEvent → const EventStreamProvider<Event>
- Static factory designed to expose
pageshow
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<Event>('pageshow')
- PERSISTENT → const int
- Indicates that file system data cannot be cleared unless given user permission. [...]
1
- popStateEvent → const EventStreamProvider<PopStateEvent>
- Static factory designed to expose
popstate
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<PopStateEvent>('popstate')
- progressEvent → const EventStreamProvider<Event>
-
const EventStreamProvider<Event>('progress')
- storageEvent → const EventStreamProvider<StorageEvent>
- Static factory designed to expose
storage
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<StorageEvent>('storage')
- TEMPORARY → const int
- Indicates that file system data can be cleared at any time. [...]
0
- unloadEvent → const EventStreamProvider<Event>
- Static factory designed to expose
unload
events to event handlers that are not necessarily instances of Window
. [...] const EventStreamProvider<Event>('unload')