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

3 Answers 3

up vote 5 down vote accepted

Neither. Use:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>

That will use whichever protocol your page was requested with.

See my reference here.

You should use this instead of linking to your own copy of this file on your server. It saves you bandwidth as you won't have to serve this file to your users (it adds up). And it makes the experience for your users better as they won't have to spend the 500 milliseconds downloading the file. Most likely, your users will have visited another web page which references Google API and will have jQuery cached. If they haven't they will pull that file from a server close to their location minimizing round trip time.

Don't let anyone convince you that this isn't the right thing to do.

share|improve this answer
    
The double // without a scheme is supported by all major browsers and has been in the browsers standard for many years (maybe from the beginning.) It's a great gem and saves lots of silly (if ssl then .. else ..) type checks. –  WaldenL Mar 27 '12 at 14:40

You should use the same protocol that your page was accessed with.

share|improve this answer

In my opinion just download it to your server and use it from there.

I do not see the benefits from using a 3rd party server for that except for really high load sites.

(Many do it anyways.)

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.