Using javascript to check which CDN jQuery is cached from on the client

Posted by Hazro City on Stack Overflow See other posts from Stack Overflow or by Hazro City
Published on 2010-12-27T08:47:06Z Indexed on 2010/12/28 12:54 UTC
Read the original article Hit count: 214

Filed under:

Can I use JavaScript to check whether JQuery is (already) downloaded (cached) on the target web browser (user) or not? For Example:

If (JQuery-from-Microsoft-CDN-downloaded)
    Then use http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.js
Else if (JQuery-from-Google-APIs- downloaded)
    Then use http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
Else if (JQuery-from-code.jquery.com- downloaded)
    Then use http://code.jquery.com/jquery-1.4.4.min.js
Else use jQuery from my own website.

Means that using the ability of javascript to check whether one of them is downloaded on the target User (Web Browser), if not then use jQuery from my own website otherwise if true then use that version of JQuery that is downloaded on the target User.

© Stack Overflow or respective owner

Related posts about jQuery