7

This will probably get a pretty nasty response, but my server isn't the fastest at the moment, and my site loads much faster if I hotlink from the jQuery homepage so they server the content. Is this bad to do? Does jQuery eventually remove those js files from their page?

alt
  • 13,357
  • 19
  • 80
  • 120

8 Answers8

11

Better hotlink it from Google API libraries.

Very big advantages:

  • Google is fast and highly available
  • Separate hosts, allows the client to load JQuery simultaneously with your pages and images (browsers support only a limited number of connections per host)
  • Probably even faster still, because many websites use it, so this Google version is probably in your visitor's cache anyway.
GolezTrol
  • 114,394
  • 18
  • 182
  • 210
7

Are you using their official CDNs? (old link) A lot of people do.

I'm not sure why everyone is so quick to say Google. The above link says very specifically that you can hotlink to the jQuery CDN:

jQuery CDN (via Media Temple)

http://code.jquery.com/jquery-1.6.1.min.js Minified version

http://code.jquery.com/jquery-1.6.1.js Source version

user185953
  • 83
  • 1
  • 6
Nic
  • 13,287
  • 7
  • 40
  • 42
2

Instead use Google's CDN. That is what it was designed for.

Vincent Ramdhanie
  • 102,349
  • 23
  • 137
  • 192
2

if it is bad I haven't heard about it. However you can use a CDN for better performance probably. Google and Microsoft also serve jQuery through their CDN for free.

cdnjs: https://cdnjs.com/libraries/jquery/

Google's CDN: http://code.google.com/apis/libraries/devguide.html#Libraries

jQuery's CDN: http://docs.jquery.com/Downloading_jQuery#CDN_Hosted_jQuery

MS's CDN: http://www.asp.net/ajaxlibrary/cdn.ashx#Third-Party_Files_on_the_CDN_14

m4tt1mus
  • 1,642
  • 14
  • 24
  • Ironically I visited a Microsoft site today and got a warning that jQuery was being served from jQuery's CDN... – Neil Jun 28 '11 at 23:22
  • Ahh, I never noticed that before. I see that they list that right above there. – m4tt1mus Jun 28 '11 at 23:48
  • 1
    Actually looking at it further it says the libraries come from someone else, not that its hosted somewhere else. I think they're saying that MS doesn't control jQuery. – m4tt1mus Jul 01 '11 at 17:46
0

If the library is not intended for loading from the URL, I would avoid it.

However, Google provides hosted versions:

http://code.google.com/apis/libraries/

Yann Ramin
  • 32,895
  • 3
  • 59
  • 82
0

You should use Google's hosted versions:

http://code.google.com/apis/libraries/devguide.html

fehays
  • 3,147
  • 1
  • 24
  • 43
0

You can use Google Libraries and link it from there : )

citizen conn
  • 15,300
  • 3
  • 58
  • 80
-6

Yes, it is bad. For your site - it will run slower. For their site - imagine what happens if everyone used it!

OOO ''MMM''
  • 240
  • 3
  • 7
  • 1
    I have to disagree with "your site .. will run slower". Retrieving it from a domain other than yours allows more parallel downloads and will most likely speed things up. Not to mention the fact that the OP specifically says that there server isn't fast. jQuerys one is almost certainly faster. Oh and there's the increased likelihood of a cache hit with a CDN version too. – tjm Jun 28 '11 at 23:05
  • 3
    Again, jQuery's site specifically says that you can hotlink to jQ from their CDN. – Nic Jun 28 '11 at 23:06