开发者

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

开发者 https://www.devze.com 2023-01-31 08:55 出处:网络
I want to know if there is any event which confirms that the complete page has been loaded without a开发者_Python百科ny errors using JQuery.

I want to know if there is any event which confirms that the complete page has been loaded without a开发者_Python百科ny errors using JQuery.

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


$(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.
});


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


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

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

精彩评论

暂无评论...
验证码 换一张
取 消