using javascript from a hosted library

KV D
KV D used Ask the Experts™
on
I am using a progress bar on my page that uses javascript from a hosted library link copied below.

Is it a reliable practice?

What if this site stops hosting this library? Can I host the code locally?
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

Open in new window


Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010
Commented:
Yes, you can host it locally.  Just download it to your server and change the src to your local directory that's relative to the page.

And that is a reliable site for hosted resources, but that version of jQuery is on the older side, so it's entirely possible it would get removed at some point.
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
What if this site stops hosting this library?
Then half the sites on the web will stop working. CDN's (Content Delivery Networks) are stock standard and used ubiquitously throughout the web - not only is it safe - it is good practice in many cases.

The CDN you quoted is Google and the library is jQuery - can't get more solid than that.
HainKurtSr. System Analyst
Commented:
I guess other than that, it reduces network traffic on your web site :) which is a good thing...
especially your server is slow, bandwidth is limited and you pay for outbound traffic...
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
One of the main reasons against hosting the script yourself is page load time. Typically browsers limit resource downloads to 2 per domain. That means if you are loading a large number of resources from your site only 2 are being downloaded at any one time. By moving resources off to other domains you increase the number of simultaneous connections and so bring down your page load time.

The number of resources can be reduced with packing as well - so usually a combination of the two strategies gives the best results.
Mukesh YadavFull Stack Developer

Commented:
One more thing you can remove the  type="text/javascript" attribute from script element this is not required.
Commented:
Typically browsers limit resource downloads to 2 per domain
This isn't the eighties


The main advantage of using a well known CDN is that the chance of your visitor already having download the resource is high so they don't have to download it again (within the refresh timeframe) meaning faster page loads for you and in the day and age of mobile usage less bandwidth for your visitor
HainKurtSr. System Analyst

Commented:
everything said here adds something valuable...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial