1

For the JQuery elements of our site I'm noticing at least two new dependencies.

One for JQuery itself <script src="http://code.jquery.com/jquery-latest.js"></script>

And another for the 3rd party form validator <script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>

What is the normal practice? It doesn't seem wise to have these kinds of dependencies on a live site. What if GitHub or Jquery.com go down? Do people usually copy these resources to a local directory on their server? And then what about updates? Do you constantly have to keep track of the latest versions?

frankie
  • 661
  • 2
  • 10
  • 25

4 Answers4

2

It is normal to use a CDN (Content Delivery Network) for common scripts like jQuery. For example, Google also hosts jQuery. The benefit is that visitors to other websites that require the same script will already have it cached when they visit your site instead of having to download it from you.

You would only need to track updates if you feel like your app needs the latest version. It is normal to link to a specific version of a script, not necessarily the latest, so your website doesn't potentially break when a new version is released.

Also, I wouldn't recommend linking directly to another website hosting the file unless they claim to be a CDN.

jimp
  • 16,999
  • 3
  • 27
  • 36
0

On a busy site, it's good practice to use good, external CDNs. They are almost always faster, backed up, reduntant and are waaaay less likely to go down than most sites.

wroniasty
  • 7,884
  • 2
  • 32
  • 24
0

Basically, it improves load performance and reduces load on your server. For more detail: https://stackoverflow.com/a/2180401/104198

Community
  • 1
  • 1
Gromer
  • 9,861
  • 4
  • 34
  • 55
0

That is the way to go and it's a good practice assuming you have opted for a reliable CDN(content delivery network).

This would mean you would save a lot on bandwidth and your performance will get better.

bad_at_coding
  • 93
  • 1
  • 8