core error

Head JS

Posted on: 28/07/2011

What

With Head JS you can load your javascript files in a non blocking way, just like images.

Why

When a page loads its JavaScript files through Head JS, the rendering is not blocked until the files are downloaded ensuring a boost in performance especially for pages with a lot of javascript code.

How

// use jQuery on the body of the page even though it is not included yet
head.ready(function() {
   $("#my").jquery_plugin();
});

// load jQuery whenever you wish bottom of the page
head.js("/path/to/jquery.js");

With this piece of code we can add js code in the body of the page without blocking the page render. For example, jQuery code can be added wherever we want even we load jQuery at the bottom.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


  • None
  • Justin Cooney: Great comic, this made me laugh!
  • Justin Cooney: Interesting, I didn't know about the Google App Engine, I'm glad I found your article on it!

Categories

%d bloggers like this: