The window
acts as a global variable, representing the window in which the script is running, and exposes properties and methods to JavaScript
.
closed
: Indicates whether the referenced window is closed.console
: Provides methods to output log information to the browser console.crypto
: This object allows web pages to access certain encryption-related services.customElements
: Can be used to register new custom elements or retrieve information about previously defined custom elements.devicePixelRatio
: Returns the ratio of the physical pixel resolution of the current display device to the CSS pixel resolution.document
: Returns a reference to thedocument
object.frameElement
: Returns the element embedded in the currentwindow
object, such as<iframe>
or<object>
, and returnsnull
if the currentwindow
object is already the top-level window.frames
: Returns an array-like object that lists all the direct child windows of the current window.fullScreen
: Indicates whether the window is in full-screen mode.history
: Provides an interface for manipulating the browser session history.indexedDB
: Integrates mechanisms to provide asynchronous access to indexed databases for applications.innerHeight
: Returns the height of the document display area of the window.innerWidth
: Returns the width of the document display area of the window.length
: Sets or returns the number of<iframe>
frames in the window.localStorage
: Provides a long-term local storage interface.location
: Contains information about the current document location.locationbar
: Returns alocationbar
object with avisibility
property that can be checked.name
: Sets or returns the name of the window.navigator
: Provides information related to the application running the current code.opener
: Returns a reference to the window that opened this window.outerHeight
: Returns the outer height of the window, including the toolbar and scrollbar.outerWidth
: Returns the outer width of the window, including the toolbar and scrollbar.pageXOffset
: Sets or returns theX
position of the current page relative to the upper left corner of the window display area.pageYOffset
: Sets or returns theY
position of the current page relative to the upper left corner of the window display area.parent
: Returns the parent window object of the current window, or returns a self-reference if there is no parent window.performance
: Allows web pages to access certain functions to measure the performance of web pages and web applications.screen
: Returns properties related to the current rendering window and screen.screenLeft
: Returns theX
coordinate relative to the screen window.screenTop
: Returns theY
coordinate relative to the screen window.screenX
: Returns theX
coordinate relative to the screen window.screenY
: Returns theY
coordinate relative to the screen window.sessionStorage
: Provides a local storage interface with current session validity.self
: Returns a reference to the current window.status
: Sets the text of the window status bar.top
: Returns a reference to the topmost window in the window hierarchy.
alert()
: Displays an alert dialog with specified text content and an OK button.atob()
: Decodes a string encoded withBase64
.btoa()
: Creates aBase64
encoded string.blur()
: Moves the keyboard focus away from the top-level window.clearInterval()
: Cancels the interval set bysetInterval()
.clearTimeout()
: Cancels the timeout set by thesetTimeout()
method.close()
: Closes the current window or a specified window.confirm()
: Displays a dialog with a message, an OK button, and a Cancel button.focus()
: Gives focus to a window.getComputedStyle()
: Gets theCSS
styles of a specified element.matchMedia()
: Returns the result object of a specified media query string parsing.moveBy()
: Moves the window created byopen
by a specified amount.moveTo()
: Moves the top-left corner of the window created byopen
to a specified coordinate.open()
: Opens a new browser window or finds a named window.postMessage()
: Safely implements cross-origin communication.print()
: Prints the content of the current window.prompt()
: Displays a dialog prompting the user for input.requestAnimationFrame()
: Provides a method for drawing animation frames to match the screen refresh rate.queueMicrotask()
: Provides a callback interface for adding to the microtask queue.resizeBy()
: Adjusts the size of the window created byopen
by a specified number of pixels.resizeTo()
: Adjusts the size of the window created byopen
to a specified width and height.scroll()
: Scrolls the window to a specific position in the document.scrollBy()
: Scrolls the document within the window by a specified offset.scrollTo()
: Scrolls the content to the specified coordinates.setInterval()
: Calls a function or evaluates an expression at specified intervals.setTimeout()
: Calls a function or evaluates an expression after a specified number of milliseconds.stop()
: Stops the loading of the page, equivalent to clicking the stop button in the browser.
onbeforeunload
: Occurs just before the document is about to be unloaded (refreshed or closed).onload
: Occurs when the document has finished loading.onunload
: Occurs when the window unloads its resources and content.onerror
: Occurs when a JavaScript runtime error or resource loading failure happens.onabort
: Event handler for the abort event sent to the window, not applicable toFirefox 2
orSafari
.
onblur
: Occurs when the window loses focus.onfocus
: Occurs when the window gains focus.onresize
: Occurs when the window size changes.onscroll
: Occurs when the window scrolls.onmessage
: Occurs when the window object receives a message.onchange
: Occurs when the content of a form element in the window changes.oninput
: Occurs when a form element in the window gets user input.onreset
: Occurs when a form in the window is reset.onselect
: Occurs when text in a form element in the window is selected.onsubmit
: Occurs when thesubmit
button in a form in the window is pressed.onhashchange
: Occurs when the anchor/hash value of the window changes.
onclick
: Triggered when the page is clicked.onmouseup
: Triggered when the mouse button is released.ondblclick
: Called when the page is double-clicked.oncontextmenu
: Triggered when the right mouse button is clicked to open the context menu.onmousedown
: Triggered when the mouse button is pressed.onmousemove
: Triggered when the mouse is moved.onmouseout
: Triggered when the mouse moves out of the window.onmouseover
: Triggered when the mouse moves over the window.onauxclick
: Indicates that a non-primary button is pressed on an input device, such as the middle button of a mouse.
onkeydown
: Triggered when a keyboard key is pressed.onkeyup
: Triggered when a keyboard key is released.onkeypress
: Triggered when a keyboard key is pressed and then released.
onanimationcancel
: Sent when aCSS
animation is unexpectedly terminated, i.e., at any time it stops running without sending ananimationend
event, for example, whenanimation-name
is changed or the animation is deleted.onanimationend
: Sent when aCSS
animation reaches the end of its active period, calculated as(animation-duration*animation-iteration-count) + animation-delay
.onanimationiteration
: Triggered when aCSS
animation completes one iteration of the sequence of animation instructions by executing the last step of the animation.
ondevicemotion
: Triggered when the device's state changes.ondeviceorientation
: Triggered when the device's relative orientation changes.ondeviceproximity
: Triggered when the device's sensor detects an object getting closer to or further away from the device.
onbeforeprint
: Triggered when the page is about to start printing.onafterprint
: Triggered when the page has started printing or the print window has been closed.
onappinstalled
: Dispatched once aWeb
application is successfully installed as a progressiveWeb
application.onbeforeinstallprompt
: Scheduled on the device when the user is about to be prompted to install aweb
application, and its associated events can be saved for later use in prompting the user at a more opportune time.
https://github.com/WindrunnerMax/EveryDay
https://www.runoob.com/jsref/obj-window.html
https://developer.mozilla.org/zh-CN/docs/Web/API/Window