There are a few ways to include jQuery and jQuery UI and I'm wondering what people are using?(有几种方法可以包含jQuery和jQuery UI,我想知道人们在使用什么?)
Google JSAPI(谷歌JSAPI)
jQuery's site(jQuery的网站)
your own site/server(你自己的网站/服务器)
another CDN(另一个CDN)
I have recently been using Google JSAPI, but have found that it takes a long time to setup an SSL connection or even only to resolve google.com.(我最近一直在使用Google JSAPI,但发现设置SSL连接需要很长时间,甚至只能解决google.com问题。) I have been using the following for Google:(我一直在谷歌使用以下内容:)
<script src="https://www.google.com/jsapi"></script>
<script>
google.load('jquery', '1.3.1');
</script>
I like the idea of using Google so it's cached when visiting other sites and to save bandwidth from our server, but if it keeps being the slow portion of the site, I may change the include.(我喜欢使用Google的想法,因此它在访问其他网站时被缓存并从我们的服务器节省带宽,但如果它一直是网站的缓慢部分,我可能会更改包含。)
What do you use?(你用什么?) Have you had any issues?(你有什么问题吗?)
Edit: Just visited jQuery's site and they use the following method:(编辑:刚刚访问过jQuery的网站,他们使用以下方法:)
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
Edit2: Here's how I've been including jQuery without any problems for the last year:(编辑2:这是我去年包括jQuery没有任何问题的方式:)
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
The difference is the removal of http:
.(不同的是删除http:
.) By removing this, you don't need to worry about switching between http and https.(通过删除它,您不必担心在http和https之间切换。)
ask by Darryl Hein translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…