W3C home > Mailing lists > Public > public-html@w3.org > October 2010

Re: Executing script-inserted external scripts in insertion order

From: Getify <getify@gmail.com>
Date: Tue, 12 Oct 2010 14:17:26 -0500
Message-ID: <82FCE1AB2BFC4EE6AD3405BA9E619013@spartacus>
To: "public html" <public-html@w3.org>
?> So it seems that this is possible today quite easily: first prime the
> browser's cache with all the scripts using one of the techniques described
> below, and then when you want to start running the script, insert them one
> at a time into the document, using the "onload" event handler to figure
> out when to load the next one.
>
> The "right" way to do cache priming is to explicitly use <link
> rel=prefetch>. As I understand it, not all browsers support rel=prefetch;
> but it turns out there's a bunch of hacks one can do already to prime the
> cache: using an <img> or an <iframe>, for example. So instead of
> rel=prefetch, you can use one of those mechanisms. (In some browsers, as
> you've seen, <script type="bogus"> is another way to do it. However, that
> interferes with the point of the type="" attribute, which is to give the
> browser a hint about whether there's any point downloading the file or
> not, so I wouldn't recommend using that. It's also non-conforming to
> specify the wrong type, since normally it indicates an authoring mistake.)

As I just explained in the other response, yes, this "preloading" (or as you 
call it, cache priming) is *a* solution to the use-case using existing 
technology. But it's far from ideal. Right now, it's the fallback/hacky 
solution that LABjs uses for IE/Webkit/Chrome ONLY because no other solution 
exists. It has several caveats/drawbacks, and it makes LABjs much more 
complicated than I would like it to be. See the other response for a more 
thorough explanation of why I assert that it's in the opposite direction of 
ideal or desired for this use-case.

--Kyle


 
Received on Tuesday, 12 October 2010 19:18:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:17:15 GMT