Jquery – Is it safe to reference google’s JQuery library

jquery

I have included a reference to Google's JQuery library in my markup:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>

Is it safe to do this? How do I know Google won't change the address, or remove it altogether? I really can't afford to have my app break without warning.

What do other people do?

Best Answer

Have the best of both worlds. Use theirs for fast, possibly pre-cached, delivery and in case their server goes down (more likely than them moving it) fallback to your own:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined')
{
    document.write(unescape("%3Cscript src='/path/to/your/jquery' type='text/javascript'%3E%3C/script%3E"));
}
</script>

Taken from: Best way to use Google's hosted jQuery, but fall back to my hosted library on Google fail