2009-09-05 54 views
12

只是想知道是否有一個網站,讓你可以熱鏈接到最新版本的jquery。谷歌代碼是否允許你,或者jQuery.com本身?有沒有一個jQuery的版本,我可以在沒有託管文件的情況下熱鏈接?

我在做什麼不是尋找是一個網站,恰好有我可以捏的jQuery。我想要一個網站,說你可以熱鏈接到他們的jQuery。

+0

有幾個網站這樣做。您需要搜索託管jQuery http://www.google.ca/search?q=hosted+jQuery – Armstrongest

回答

30

是的,它可以在Google的CDN上找到。你需要

一切都在這裏:http://code.google.com/apis/libraries/

您可以直接鏈接到的JavaScript文件:https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js

或使用google.load方法


更新

它也可通過Microsoft's CDN或獲得

+0

Google代碼鏈接已損壞,Google似乎已將其移至其他網址。 –

+0

@lorin - 我更新了鏈接。謝謝。 –

+0

有趣的更新:https://code.jquery.com的證書今天過期,所以很多人從那裏盜鏈出現網站問題。 – Sparr

10

你可以有谷歌主持它1 2的方法。

方法1

<script type="text/javascript" 
     src="http://www.google.com/jsapi"></script> 
<script type="text/javascript"> 
    // You may specify partial version numbers, such as "1" or "1.3", 
    // with the same result. Doing so will automatically load the 
    // latest version matching that partial revision pattern 
    // (i.e. both 1 and 1.3 would load 1.3.2 today). 
    google.load("jquery", "1.3.2"); 

    google.setOnLoadCallback(function() { 
    // Place init code here instead of $(document).ready() 
    }); 
</script> 

方法2(多見)

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

我知道jquery.com主機的文件以及對於用戶來說,他們可能會重定向有託管的jQuery儘管使用谷歌版本。

相關問題