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.
@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
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
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
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
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.
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
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
> 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
On Oct 6, 2009, at 11:02 PM, John Resig wrote:
> You could probably do something like this:
>
>
>
> if ( typeof jQuery === "undefined" ) {
> document.write("