引用Google的JQuery库是否安全? [英] Is it safe to reference google's JQuery library?

查看:80
本文介绍了引用Google的JQuery库是否安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经引用了 Google的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>

这样做安全吗?我怎么知道Google不会更改地址或将其完全删除?我真的无法在没有警告的情况下中断我的应用程序.

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.

其他人做什么?

推荐答案

兼得两全.使用他们的服务器进行快速(可能是预先缓存的)交付,并在服务器发生故障(比他们移动它的可能性更大)时退回您自己的服务器:

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>

来自: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆