I'm developing sites using Wordpress and I want to use the lates version of jQuery.
To make sure I use the lates version, I have found this piece of code from Binary Bonsai's example.
What I see, is that he actually links to jQuery at Google API.
So my question is, what is better.
To link to jQuery on an external page?
http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
or to have the jquery file locally?
wp_enqueue_script('jquery', '/js/jquery-1.4.2.min.js');
You can leave out the minor or dot versions when linking to the google CDN copies, like this:
Given this flexibility, I much prefer the remote version, it's quick to get bug fixes by just changing the URL and the file's loaded faster (in most cases) because it's pulled from another domain (and not in the count of parallel requests to your domain). There are other related questions on this, here and here.