Google 代管的程式庫是一套穩定、可靠、高速且全球可用的內容發布網路,適用於最受歡迎的開放原始碼 JavaScript 程式庫。

Google 直接與主要利害關係人合作,共同處理每個程式庫工作,並在最新版本發布時接受新版本。

程式庫

如要載入代管的程式庫,請複製該程式庫的 HTML 程式碼片段 (如下所示) 並貼到網頁中。舉例來說,如要載入 jQuery,請在您的網頁中嵌入 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> 程式碼片段。

即使您的網站只使用 HTTP,仍建議您透過 HTTPS 從 CDN 載入程式庫。現今的效能相當快,且快取的運作方式也是如此。CDN 檔案會以 CORSTiming-Allow 標頭提供,並允許快取 1 年。

CesiumJS

文字片段:
<script src="https://ajax.googleapis.com/ajax/libs/cesiumjs/1.78/Build/Cesium/Cesium.js"></script>
site:
github.com/CesiumGS/cesium
版本:
1.78

D3.js

程式碼片段:
<script src="https://ajax.googleapis.com/ajax/libs/d3js/7.9.0/d3.min.js"></script>
site:
d3js.org
versions:
7.9.0、7.8.5、7.8.4、7.8.3、7.8.2、7.8.1、7.8.0、7.7.0、7.6.1、7.4.2、7.6.1 6.7.0



Dojo

文字片段:
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.13.0/dojo/dojo.js"></script>
site:
dojokit.org
版本:
175 分

Ext Core

文字片段:
<script src="https://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core.js"></script>
site:
sencha.com/products/extcore
版本:
3.1.0、3.0.0

Hammer.JS

文字片段:
<script src="https://ajax.googleapis.com/ajax/libs/hammerjs/2.0.8/hammer.min.js"></script>
site:
hammerjs.github.io
版本:
2.0.8

Indefinite Observable

文字片段:
<script type="module">
  import { IndefiniteObservable } from "https://ajax.googleapis.com/ajax/libs/indefinite-observable/2.0.1/indefinite-observable.bundle.js";
</script>
site:
https://github.com/material-motion/indefinite-observable-js
版本:
2.0.1、1.0.1

jQuery

3.x 程式碼片段:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
2.x 程式碼片段:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
1.x 程式碼片段:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
site:
jquery.com
版本:
.7.1、.1.1、.1.2.1、2.1、2.1、2.1、2.1、2.1、2
注意:
3.3.0、2.1.2、1.2.5 和 1.2.4 原因是這類欄位在野外生活不穩定,

jQuery Mobile

文字片段:
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.js"></script>
site:
jquerymobile.com
版本:
1.4.5、1.4.4、1.4.3、1.4.2、1.4.1、1.4.0
注意:
此程式庫依附於 jQuery。您也必須載入 jQuery,再載入這個模組。

jQuery UI

snippet:
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.13.3/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.13.3/jquery-ui.min.js"></script>
site:
jqueryui.com
versions:
1.13.3, 1.13.2, 1.13.1, 1.13.0, 1.12.1, 1.12.0, 1.11.4, 1.11.3, 1.11.2, 1.11.1, 1.11.0, 1.10.4, 1.10.3, 1.10.2, 1.10.1, 1.10.0, 1.9.2, 1.9.1, 1.9.0, 1.8.24, 1.8.23, 1.8.22, 1.8.21, 1.8.20, 1.8.19, 1.8.18, 1.8.17, 1.8.16, 1.8.15, 1.8.14, 1.8.13, 1.8.12, 1.8.11, 1.8.10, 1.8.9, 1.8.8, 1.8.7, 1.8.6, 1.8.5, 1.8.4, 1.8.2, 1.8.1, 1.8.0, 1.7.3, 1.7.2, 1.7.1, 1.7.0, 1.6.0, 1.5.3, 1.5.2
note:
This library depends on jQuery. You must also load jQuery before loading this module. Version 1.8.3 is not hosted due to its short life, and the alias 1.8.3 actually loads 1.8.4.

List.js

文字片段:
<script src="https://ajax.googleapis.com/ajax/libs/listjs/2.3.1/list.min.js"></script>
site:
listjs.com
版本:
2.3.1

Material Motion

snippet:
<script type="module">
  import {
    Draggable,
    Point2DSpring,
    Tossable,
    combineStyleStreams,
    getPointerEventStreamsFromElement,
  } from "https://ajax.googleapis.com/ajax/libs/material-motion/0.1.0/material-motion.bundle.js";
</script>
site:
https://github.com/material-motion/material-motion-js
versions:
0.1.0

Model-Viewer

文字片段:
<script src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.0.0/model-viewer.min.js"></script>
site:
modelviewer.dev
版本:
3.0.1/1/1/3/1/1/1/1/2/1/1/2/1/1/1/1/1/10 0010/1/10/1/10/1/200/1000/1/10/1/0/1/0/0/1/0/0/1/0/0/1/0/0/1/0/0/1/0/000000/0/1、1/1/2/ 1/1/1/0/1/0/1/1/0 與不與走動的 1/1/2/1.3/

MooTools

文字片段:
<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.6.0/mootools.min.js"></script>
site:
mootools.net
版本:
1.6.0、1.5.2、1.5.1、1.5.0、1.4.5、1.4.4、1.4.3、1.4.2、1.4.1、1.4.0、1.3.2、1.3.1、2.2
注意:
在 1.5.1 以下版本中,壓縮版本的檔案名稱稱為 mootools-yui-compress.js,而非 mintools.min.js。

Myanmar Tools

snippet:
<script src="https://ajax.googleapis.com/ajax/libs/myanmar-tools/1.2.1/zawgyi_detector.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/myanmar-tools/1.2.1/zawgyi_converter.min.js"></script>
site:
https://github.com/google/myanmar-tools/
recommended versions:
1.2.1
all hosted versions:
1.0.1
1.1.0
1.1.1
1.1.3
1.2.0
1.2.1

Prototype

文字片段:
<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.3.0/prototype.js"></script>
site:
prototypejs.org
版本:
1.7.3.0、1.7.2.0、1.7.1.0、1.7.0.0、1.6.1.0、1.6.0.3、1.6.0.2

script.aculo.us

snippet:
<script src="https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js"></script>
site:
script.aculo.us
versions:
1.9.0, 1.8.3, 1.8.2, 1.8.1
note:
This library depends on Prototype. Before loading this module, you must load Prototype.

Shaka Player

程式碼片段:
<!-- for non-UI builds: -->
<script src="https://ajax.googleapis.com/ajax/libs/shaka-player/4.9.2/shaka-player.compiled.js"></script>

<!-- or, for UI builds: -->
<script src="https://ajax.googleapis.com/ajax/libs/shaka-player/4.9.2/shaka-player.ui.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/shaka-player/4.9.2/controls.css">
site:
https://github.com/google/shaka-player/
維護版本:
4.9.2、4.8.10、4.7.15、4.6.18、4.5.0、4.4.3、4.3.16、4.2.14
所有託管版本:
4.9.0 - 4.9.2、4.8.0 - 4.8.10、4.7.0 - 4.7.15、4.6.0 - 4.4.3、4.4.0 - 4.4.0 - 4.9.2、4.8.0 - 4.8.10

SPF

文字片段:
<script src="https://ajax.googleapis.com/ajax/libs/spf/2.4.0/spf.js"></script>
site:
youtube.github.io/spfjs
版本:
2.4.0、2.3.2、2.3.1、2.3.0、2.2.0、2.1.2、2.1.1、2.1.0、2.0.1、2.0.0

SWFObject

文字片段:
<script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
site:
github.com/swfobject/swfobject
版本:
2.2、2.1

three.js

文字片段:
<script src="https://ajax.googleapis.com/ajax/libs/threejs/r84/three.min.js"></script>
site:
threejs.org
版本:
r84、r83、r82、r81、r80、r79、r78、r77、r76、r75、r74、r73、r72、r71、r70、r69、r68、r67、r49

Web Font Loader

文字片段
<script src="https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js"></script>
site:
github.com/typekit/webfontload
版本:
1.6.26、1.6.16、1.5.18、1.5.10、1.5.6、1.5.3、1.5.2、1.5.0

疑難排解

看到過時版本嗎?確認您使用的不是「自動版本」連結 (例如 /jqueryui/1/...),而是使用指向確切版本的網址。由於快取問題需要避免,甚至次要版本之間出現不相容的狀況,我們已提前淘汰並停止更新自動版本別名,因此這些別名將永遠無法更新舊版服務,以免影響仍在使用這類別名的現有網站。

如果您遇到下列問題: