Reacting to Page Events

Learn about the type of page events that are occurred by interacting with a page.

We'll cover the following

Page loading

Depending on how complex it is, a web page can take time to be entirely loaded by the browser. You can add an event listener on the load event produced by the window object (which represents the browser window) to know when this happens. This avoids messy situations where JavaScript interacts with pages that aren’t fully loaded.

The following code displays a message in the console once the page is fully loaded.

Get hands-on with 1200+ tech skills courses.