You could probably do something like this:
<script src="somecdn.com/jquery.js"></script>
<script>
if ( typeof jQuery === "undefined" ) {
document.write("<script src='local/jquery.js'></script>");
}
</script>
It's not shiny, but it would work - and avoid loading two copies of jQuery.
--John
On Tue, Oct 6, 2009 at 5:53 PM, Steven Black <[email protected]> wrote:
>
> Many of us use CDNs to load jQuery and jQueryUI+themes and we can all
> agree this is a great service and a nice performance goodie.
>
> I wonder, has anyone written or seen anything about a fast and robust
> CDN failover strategy?
>
> Consider these scenarios, for example:
>
> * You're developing, but all your pages deep-link into a .JS-framework
> CDN, but you don't currently have a live internet connection.
>
> * Your end-user can access your website but, for any of a number of
> plausible reasons, ajax.googleapis.com isn't responding so your end-
> user isn't well-served.
>
> Any ideas? Can you think of a fast and robust wrapper that could, as
> required, fetch jQuery framework files from, say, the virtual /js
> folder -- an arbitrary alternate location -- if the CDN isn't
> reachable?
>
> **--** Steve
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" 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/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---