Window
- It represents the browser's window.
- Global variables are properties of the window object.
- Global functions are methods of the window object.
- The document object is a property of the window object.
Window Size
window.innerHeight
: returns the inner height of the browser window in pixelswindow.innerWidth
: returns the inner width of the browser window in pixels.
Window Screen
window.screen
: object contains information about the user's screen.window.screen.width
: returns the width of the visitor's screen in pixels.window.screen.height
: returns the height of the visitor's screen in pixels.window.screen.availWidth
: returns the width of the visitor's screen, in pixels, minus interface features like the Windows Taskbar.window.screen.availHeight
: returns the height of the visitor's screen, in pixels, minus interface features like the Windows Taskbar.
Location
window.location.href
: returns the href (URL) of the current pagewindow.location.assign()
: loads a new documentwindow.location.protocol
: returns the web protocol used (http: or https:)window.location.hostname
: returns the domain name of the web hostwindow.location.pathname
: returns the path and filename of the current page
History
Contains the browsers history
history.back()
: method loads the previous URL in the history list.history.forward()
: method loads the next URL in the history list.
Timing Events
setTimeout
: Executes a function, after waiting a specified number of milliseconds.clearTimeout
: stops the execution of the function specified in setTimeout().setInterval
: Repeats a given function at every given time-interval.clearInterval
: stops the executions of the function specified in the setInterval() method