Skip to content

Window Object

win

win.listen

win.listen(event, callback)

Adds an event listener to the window. Equivalent to window.addEventListener(event, callback).

win.unlisten

win.unlisten(event, callback)

Removes an event listener from the window. Equivalent to window.removeEventListener(event, callback).

win.alert

win.alert(message)

Displays an alert dialog with the specified message. Equivalent to window.alert(message).

win.confirm

win.confirm(message)

Displays a dialog with a message and OK/Cancel buttons. Returns true if OK is pressed, false otherwise. Equivalent to window.confirm(message).

win.prompt

win.prompt(message, default)

Displays a dialog with a message prompting the user to input some text. Returns the input value or null if canceled. Equivalent to window.prompt(message, default).

win.open

win.open(url, target, features)

Opens a new browser window or tab with the specified URL, target, and features. Equivalent to window.open(url, target, features).

win.close

win.close()

Closes the current window. Equivalent to window.close().

win.location.href

win.location.href

Gets or sets the URL of the current window. Equivalent to window.location.href.

win.location.reload

win.location.reload()

Reloads the current page. Equivalent to window.location.reload().

win.location.assign

win.location.assign(url)

Loads a new document. Equivalent to window.location.assign(url).

win.location.replace

win.location.replace(url)

Replaces the current document with a new one without saving the current document in the session history. Equivalent to window.location.replace(url).

win.history.back

win.history.back()

Navigates to the previous page in the history stack. Equivalent to window.history.back().

win.history.forward

win.history.forward()

Navigates to the next page in the history stack. Equivalent to window.history.forward().

win.history.go

win.history.go(delta)

Navigates to a specific page in the history stack, relative to the current page. Equivalent to window.history.go(delta).