JS Web APILesson 36Free preview
JS Window API
This lesson is part of JavaScript · All levels
Summary
The window object represents the window where all JavaScript code in the browser is running, so the global variable is essentially a window property. Windows provides many APIs such as alert, confirm, prompt, location for navigation, as well as innerWidth and innerHeight to determine screen size. Most methods in the window are blocking, so overuse can interfere with the user experience.
Key points
- Window is a global object; window.x is equal to the global variable x
- Alert(), confirm(), and prompt() displayed blocking dialogs
- Location.href moved the page, location.reload() reloaded
- InnerWidth, innerHeight, open(), and close() manage the browser window
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.