开发者

What are pros and cons of letting Google host jQuery for me? [duplicate]

This question already has answers here: 开发者_C百科 Closed 12 years ago.

Possible Duplicate:

Should I link to Google API’s cloud for JS libraries?

Do you serve jQuery to your users from Google on a public websites ?


Pros:

  • There is a very high chance that your site users will already have the file cached on their computer which speeds up load time.

Cons:

  • If Google is down, your site won't work.
  • If you need to use your site (say on an intranet, or local computer) without internet access, you can't.

Google Uptime: I saw it argued here before on another question that Google will have better uptime than your server. But funny enough, another commenter brought up this point: When will it ever matter that your JS has better uptime than the rest of your site.


pros will be that it will be cached for uses that visited another site that also uses Google hosted jQuery

con: if Google is down then your jQuery is unavailable


Pros have been listed by SQLMenace, but I have a con very few ever mention. Google sometimes hangs on requests. Its true with their JQuery, with their Analytics, their Maps etc.


Google is faster than your server :)

Google being down is highly unlikly and also somthing the world couldnt handle, but if you are on an internal network where your server doesnt have any internet access you cant use google JQuery hosting (Obviously)

And look at this site. Jquery comes from Google.


Save some bandwidth for your server.
If some other site is also using the same version from google CDN, your application can use the cached one and makes pages little bit faster.


If you develop Intranet applications, then you can't expect that the client has a connection to the Internet to getto the jQuery files.

For example, don't use it when you're developing the setup webapp for a WiFi router, since you don't always have an uplink available.


On development I will just link it to googles, save me downloading it all the time, however for production I stick to a hard copy on my server.

Reasons:

a) If Google is down I loose functionality
b) If Google's version gets hacked then it could compromise my site
c) Easier to keep up to date on hard copy, and can roll back easy enough by changing the file name.


Pro: CDN's should be in more than one location, where your web site is probably in one location (unless using cloud computing or something). So if JQuery comes from your site, that's one location, where a CDN could have potentially multiple locations to stream it from.

It has HTTP and HTTPS so you can work with both (if you reference a script from HTTP when your site is HTTPS, you will get a browser warning).

Con: They only have the JQuery core and UI script files I believe; they don't have some of the other useful scripts that would be great to have in a CDN (some of the UI scripts or popular plugins).

Local development requires internet connection, which is not a bad thing at the office, but is bad if the connection is glitchy or you are working remotely with no internet connection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜