I'm using JQuery for the first time on a new site. I love it, but I had some worries.<p>I really want my site to be snappy, but it seems that downloading JQuery, even when minified, can cause a decent performance hit.<p>Is this worry justified? If so, is there anything I can do? Can something like GWT do the same basic stuff that JQuery does (and thus reap the performance benefits from less code to DL)?<p>Also, if this is a problem, and since I see a lot of sites using jQuery these days, why can't the browsers bundle the framework in their browser so the user doesn't have to download it each HTTP hit (of course, using the bundled framework would be optional)?<p>Thank you.
if you grab Jquery from Google, you'll get more performance especially in speed, as the browser need to download it only once and then can work with it on all sites<p>Read more here <a href="http://encosia.com/2008/12/10/3-reasons-why-you-should-let-google-host-jquery-for-you/" rel="nofollow">http://encosia.com/2008/12/10/3-reasons-why-you-should-let-g...</a>
use google's ajax libraries. they do everything for you, including caching them properly.<p><a href="http://code.google.com/apis/ajaxlibs/" rel="nofollow">http://code.google.com/apis/ajaxlibs/</a>
Let google host it for you: <a href="http://code.google.com/apis/ajaxlibs/" rel="nofollow">http://code.google.com/apis/ajaxlibs/</a><p>Using Google's version also means that it will only be cached once between all the sites that use it. This is similar to what you're talking about with bundling it in the browser,
You need to set the cache control for the file to some far off date in future. Doing this will make sure the browser doesn't download the file each and every time the users visits your website. If you are using Apache you add this to your conf file.<p><FilesMatch "\.(jpg|jpeg|png|gif|js|css)$">
Header set Cache-Control "public"
Header set Expires "26 June 2210 20:00:00 GMT"
</FilesMatch>