[jquery-dev] Re: CDN failover to domain-provided js files?

2009-11-24 Thread Diego Perini
Steven, you may give this a try too, this in the spirit of reusing what we already have available in browsers: The "onerror" event hook should be available and usable on current browsers and it allows you to have more complex function being called handling the error, maybe with multiple retries.

[jquery-dev] Re: CDN failover to domain-provided js files?

2009-10-12 Thread getify
@Jörn -- The technique of trying to provide a failover option from a CDN to a local copy is, in my opinion, no more "introducing another point of failure" than it is in hardware failover where you have two disks (or disk arrays) mirrored, so in case one dies, the backup mirror can take over. Jus

[jquery-dev] Re: CDN failover to domain-provided js files?

2009-10-11 Thread Jörn Zaefferer
Aren't you just introducing another point of failure? Jörn On Sat, Oct 10, 2009 at 6:20 PM, getify wrote: > > Couldn't there be a special URL for a CDN, like an "are you alive" > type url, that we load first, and then, if that works (and quickly), > we proceed to load the other files. If not, t

[jquery-dev] Re: CDN failover to domain-provided js files?

2009-10-10 Thread getify
I should mention that this particular approach (which is basically the same as the previous messages with appendChild/prependChild) is dangerous right now with jquery 1.3.2 and below. There's a bug that's been patched for upcoming 1.3.3 which allows jquery to *properly* detect if it's loaded to a

[jquery-dev] Re: CDN failover to domain-provided js files?

2009-10-10 Thread getify
Couldn't there be a special URL for a CDN, like an "are you alive" type url, that we load first, and then, if that works (and quickly), we proceed to load the other files. If not, the CDN is assumed to be "down" (or at least too slow), so we failover to loading local versions. This is a really ro

[jquery-dev] Re: CDN failover to domain-provided js files?

2009-10-10 Thread Steven Black
I just tested this in a variety of ways and both John's and Phil's methods work great and you're right: appendChild and prependChild both work. Cool! **--** Steve On Oct 9, 10:44 pm, Michael Geary wrote: > prependChild or appendChild wouldn't make any difference; they're both > asynchronous.

[jquery-dev] Re: CDN failover to domain-provided js files?

2009-10-09 Thread Michael Geary
prependChild or appendChild wouldn't make any difference; they're both asynchronous. Regarding that sub-packet-sized package with a fast timeout, how would you implement that short of recompiling the browser? :-) -Mike On Fri, Oct 9, 2009 at 6:54 PM, Steven Black wrote: > > First of all, thank

[jquery-dev] Re: CDN failover to domain-provided js files?

2009-10-09 Thread Steven Black
First of all, thanks @jresig because that's just way too elegant. I was anticipating something far more complex. A couple of questions: If http://cdn/jQuery.js fails, we want the local-domain jQuery.js to load next, BEFORE the any other subsequent script which is likely a $ (function(){}) or a

[jquery-dev] Re: CDN failover to domain-provided js files?

2009-10-09 Thread Dave Methvin
> I took this great idea and went ahead implementing it on a few sites I > maintain using different syntax. It's more than a syntax change; it's entirely different semantics. Your version fetches a copy of jQuery asynchronously. If there is a .ready() handler below that block of code, jQuery may

[jquery-dev] Re: CDN failover to domain-provided js files?

2009-10-09 Thread Phil Dokas
On Oct 6, 2009, at 11:02 PM, John Resig wrote: > You could probably do something like this: > > > > if ( typeof jQuery === "undefined" ) { > document.write("