是否有“最新"的链接?Google API 上的 jQuery 库? [英] Is there a link to the "latest" jQuery library on Google APIs?

查看:10
本文介绍了是否有“最新"的链接?Google API 上的 jQuery 库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 <script> 标签中使用以下 jQuery 链接:

I use the following for a jQuery link in my <script> tags:

http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js

有最新"版本的链接吗?类似于以下内容(不起作用):

Is there a link to the "latest" version? Something like the following (which doesn't work):

http://ajax.googleapis.com/ajax/libs/jquery/latest/jquery.js

(显然不一定是将您的代码链接到可能会更改的库但在开发中很有用的好计划.)

(Obviously not necessarily a great plan to link your code to potentially changing libraries but useful in development.)

推荐答案

直到 jQuery 1.11.1,您可以使用以下 URL 获取最新版本的 jQuery:

Up until jQuery 1.11.1, you could use the following URLs to get the latest version of jQuery:

  • https://code.jquery.com/jquery-latest.min.js - jQuery hosted (minified)
  • https://code.jquery.com/jquery-latest.js - jQuery hosted (uncompressed)
  • https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js - Google hosted (minified)
  • https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js - Google hosted (uncompressed)

例如:

<script src="https://code.jquery.com/jquery-latest.min.js"></script>

<小时>

但是,从 jQuery 1.11.1 开始,jQuery 和 Google 都停止更新这些 URL;它们将永远固定在 1.11.1.没有受支持的替代 URL 可供使用.有关为什么会出现这种情况的解释,请参阅此博客文章;不要使用 jquery-latest.js.


However, since jQuery 1.11.1, both jQuery and Google stopped updating these URL's; they will forever be fixed at 1.11.1. There is no supported alternative URL to use. For an explanation of why this is the case, see this blog post; Don't use jquery-latest.js.

两个主机都支持 httpshttp,因此请根据需要更改协议(或使用 协议相对URI)

Both hosts support https as well as http, so change the protocol as you see fit (or use a protocol relative URI)

另见:https://developers.google.com/speed/libraries/devguide

这篇关于是否有“最新"的链接?Google API 上的 jQuery 库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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