Is it bad to hotlink jQuery from jquery.com?

2019-04-28 18:40发布

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?

8条回答
在下西门庆
2楼-- · 2019-04-28 19:10

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

查看更多
甜甜的少女心
3楼-- · 2019-04-28 19:13

Are you using their official CDNs? 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

查看更多
We Are One
4楼-- · 2019-04-28 19:18

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.
查看更多
劫难
5楼-- · 2019-04-28 19:19

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/

查看更多
手持菜刀,她持情操
6楼-- · 2019-04-28 19:21

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

查看更多
狗以群分
7楼-- · 2019-04-28 19:25

You should use Google's hosted versions:

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

查看更多
登录 后发表回答