Puru
Puru

Reputation: 9083

Is there any event to say the body of the page has been loaded?

I want to know if there is any event which confirms that the complete page has been loaded without any errors using JQuery.

Without any errors : I mean if some of the js or css files are missing then the page loads with errors.

Upvotes: 1

Views: 72

Answers (3)

RageZ
RageZ

Reputation: 27313

No you cannot make sure if there was some error on the page. Depending on the browser you might be able to use some specific API like firebug api in firefox but there is no standard way to do it.

If by error you mean any javascript error like syntax error runtime errors

Upvotes: 1

kobe
kobe

Reputation: 15835

errors can happen inside , but below one ensures everything is loaded including graphics

$(window).load(function () {
  // run code
});

Upvotes: 0

Macy Abbey
Macy Abbey

Reputation: 3887

$(document).ready(function(){
    //the DOM is ready for manipulation

});

$(document).load(function(){
   //the DOM is ready and external resources have been downloaded.
   //this may not always fire due to failed requests for external resources.
});

Upvotes: 2

Related Questions