Open GoogleCodeExporter opened 9 years ago
It might be esp. valuable to do this for IE.
In menu.php the two scripts (jquery.min.js and fg.menu.js) get loaded twice -
first as images and then as scripts. The intention is that the 2nd pass (as
scripts) would be read from cache. But when I run the example multiple times
one or both of the scripts frequently get re-requested and generate a 200
response - so they're downloaded twice.
I believe this is due to quirky caching behavior in IE - if you have a Vary
header and no ETag then IE is flaky about caching. In this case those scripts
have a Vary header and no ETag (or at least a blank ETag).
Therefore, it's more likely that the current technique (load as image then load
as script) will cause double downloads in IE. If instead we move to this new
approach where the file is only requested once, the issue is avoided.
Original comment by stevesou...@gmail.com
on 17 Dec 2010 at 1:29
It should be noted that this will work only in IE -- the other browsers either
do not begin to download the script until it's inserted (Opera) or don't
provide the readystatechange event.
IMO, this seems to be an elegant means by which dynamic scripts can be managed.
The recommendation of a noted wpo expert to the w3c to include readystate
notification in the HTML 5 specification would carry considerable weight.
Original comment by serverhe...@gmail.com
on 17 Dec 2010 at 6:08
Attached patch contains two fixes: 1) undefined variables in non-IE browsers
and 2) resolution to the problem of aborted connections due to premature GC.
Demonstration of #2: http://digital-fulcrum.com/webperf/ieabort/fail/
Original comment by serverhe...@gmail.com
on 23 Dec 2010 at 8:05
Attachments:
Step 12 in the HTML5 specification
(http://www.w3.org/TR/html5/scripting-1.html#running-a-script) suggests the
following:
"For performance reasons, user agents may start fetching the script as soon as
the attribute is set, instead, in the hope that the element will be inserted
into the document."
In Browsers that implement this suggestion (currently only IE) pre-fetching can
be accomplished simply by creating the script and assigning its src attribute
-- when execution is desired, the script can be inserted into the document.
This patch waits until the script element transitions to the "loaded" state
before it will be inserted and is overly complex and relies on a non-standard
property and event.
It probably makes more sense to use the specification's suggestion as the
*core* of the pre-fetching. I personally believe we should make the
non-conforming browser vendors aware of this suggestion in the spec. Should
they choose NOT to implement it, does it make sense for ControlJS to
consciously *subvert* their decision?
Original comment by serverhe...@gmail.com
on 27 Dec 2010 at 7:09
Original issue reported on code.google.com by
serverhe...@gmail.com
on 17 Dec 2010 at 1:09Attachments: