JAVASCRIPT Tutorial
The window object is accessible through the window
variable. It provides a wealth of information and functionality related to the browser window.
window.innerHeight
: Height of the window in pixels.window.location
: Object representing the current URL and its components.window.history
: Object providing access to the browser's history.window.open()
: Opens a new browser window or tab.window.alert()
: Displays a message dialog.window.setInterval()
: Sets a timer that repeatedly calls a function.// Get the current URL
console.log(window.location.href);
// Open a new window
window.open("https://www.example.com", "_blank");
// Set a timer to run a function every second
window.setInterval(() => {
console.log("Time passed...");
}, 1000);
window.accessible
property to check if the user has enabled accessibility features in their browser.window.altText
property.window.caption
property to set a title for the browser window.