Window.load all the way.

Ask your questions about the best ways to optimize your site to rank highly in the search engines. Learn how to fine tune your website for optimal search engine ranking and SEO.

Moderator: John55

Window.load all the way.

Postby rajiv123 » Sat Jul 03, 2010 6:59 pm

Document.ready isn’t a terrible thing, but it’s a habit that many developers still have including myself occasionally. It doesn’t matter where you’re using $(function(){}); or the full version of this, but truth be told it is significantly more optimal to be using Window.load in your applications.

The reason behind this idea is that document.ready happens during page render while objects are still downloading and that cause some stalls in your page. You don’t want that. You can however reduce the CPU utilization during the page load by binding your jQuery functions to the $(window).load event – it occurs after all objects called by the HTML have fully completed downloading.

That’s one line change that can give you scripts that little extra performance boost!.
rajiv123
 
Posts: 36
Joined: Sun Jan 17, 2010 2:19 pm

Return to Optimization Tips & Techniques

Who is online

Users browsing this forum: No registered users and 4 guests

cron