As long as you make sure to load jQuery first, and in a synchronous fashion, you should be okay. The Google Libs API allows you to do this in a couple of ways: either by calling the script directly, or by utilizing the google.load method without a callback. In the first case, the browser will see the script tag and load that script, waiting to load all others until the first one is complete. And in the second case, the loader uses a document.write call to write a script tag into the page, effectively resulting in exactly the same thing. So unless Google's CDN simply stops serving jQuery, you should be okay as long as you run these things first.
Jeremy R. Geerdes Effective website design & development Des Moines, IA For more information or a project quote: http://jgeerdes.home.mchsi.com [email protected] If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church! On May 23, 2010, at 4:54 AM, cootetom wrote: > Hi all, > > I have a question about serving jQuery via google CDN for use on a web > page. The scenario is as follows: > > 1. You load in jQuery from a CDN but all other JavaScript files from > the local server. > 2. The other JavaScript files use the jQuery object, say $(function() > { ... }); > 3. The local files load in before jQuery via the CDN. > 4. The local files error. > > So my question is that is the above scenario plausible? If using a > CDN, isn't it more sensible to use it for say all JavaScript files or > all image files etc? If we have JavaScript files that rely upon each > other to work that are being loaded from different domains, isn't it a > recipe for disaster? > > - Tom > > -- > You received this message because you are subscribed to the Google Groups > "Google AJAX APIs" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-ajax-search-api?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en.
