Languages
[Edit]
EN

JavaScript - event fired when all web page is loaded

7 points
Created by:
Remy-Lebe
832

Quick solution:

Note: read this article to know about load event order.

Below the events usage are presented in details.

1. Body load event examples

Edit

This event is called when body element is ready, scripts executed and all synchronous resources are loaded (frames, objects, images, etc.).

1.1. onload attribute event

Edit

1.2. onload property event

Edit

This event is called when body element is ready, scripts executed and all synchronous resources are loaded (frames, objects, images, etc.).

document.body property used in below example is not avaialbe until body element is created - access it from inside body element.

2. Window load event example

Edit

This event is called when whole web page is ready, scripts executed and all synchronous resources are loaded (frames, objects, images, etc.).

2.1. onload property event

Edit

2.2. Event listener and load event

Edit

3. DOMContentLoaded event example

Edit

This event occurs when the DOM is ready without waiting to load for the stylesheets, images and subframes.

Note: this approach is not supported in Iinternet Explorer and Opera < 9.

 

Alternative titles

  1. JavaScript - jQuery ready event in Vanilla JS
  2. JavaScript - web page onready event in pure js
  3. Web Page onReady event in pure JavaScript
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join