Thursday, October 11, 2012

How to check Complete Page Load by JavaScript

In a client-side application. your application is initializing any control or populating a large amount of data in your control. 

You need to execute a script after DOM is ready and ALL of the other assets in the page (images, etc.) are loaded.

Use window.onload event. This event will not fire until both DOM is ready and ALL of the other assets in the page (images, etc.) are loaded.

Once your page is loaded completely this event automatically fired.

There is other way around put onload event in your body tag.

If you need to execute some script after your page load in your js file. 

window.onload = function(){

  // Write your script
  alert("Page is loaded completely");

}

No comments:

Post a Comment