Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm thinking about whether it makes more sense to include the http://code.jquery.com/jquery-latest.min.js file from the jQuery website, rather than hosting it on your own server, since 1st time visitors probably already have the jquery-latest.min.js from jquery.com downloaded and will be able to use a cached version of it, so page load time will be a bit faster.

Does anyone know how this works and want to share their thoughts? Do you think it is irrelevant or could there be some milliseconds to gain :) ?

share|improve this question
    
You should most definately not include the jQuery script from code.jquery.com - blog.jquery.com/2010/12/30/… - Instead use the Google or Microsoft CDNs. –  sam Aug 8 '11 at 13:10
    
A-ha thanks for the heads up! –  ulvund Aug 8 '11 at 13:48

1 Answer 1

up vote 0 down vote accepted

most browsers will make anywhere from 4-6 parallel get requests to the same hostname to get css/js/images from the server. So if all your assets point to the same hostname then offloading the jquery one might be a good idea for speed for those that do not even have it cached cause the browser will make an additional get request after the 4-6 to get your assets.

The better place to link the file is the google cdn though

http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js

That way the download will happen from a server closer to the user.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.