Re: Dynamic loading of javascript files into web pages



On 29/06/09 21:32, David Mark wrote:
On Jun 29, 1:18 pm, Conrad Lender <crlen...@xxxxxxxxx> wrote:
What I have been using is execScript(), if available, or else
window.eval, if available. I'm not happy with this solution, because
both are nonstandard, and not guaranteed to work (IIRC, window.eval is
even guaranteed *not* to work in ES5 strict mode). I wouldn't be
surprised if there were reasonably current UAs which support neither.

Neither of those are acceptable.

Yes, I just said that.

There's a lot about this topic on the web, and in the group archives.
Has there ever been a consensus in this group about the best/safest way
to evaluate code in global context?

As have been mentioned in this thread, search the archive for "dynamic
script injection" (and/or "Webb.")

The problem is that there has been so much discussion about it that it
makes the relevant bits hard to find. If this has been discussed so
much, and is frequently asked, it should probably go in the FAQ, which
would save people from sifting through thousands of posts containing
half-solutions and esoteric cases every time.

Is it really too much to ask which is the "recommended" approach? Is it
creating a script element, setting its .type, adding the code as its
..text, and appending it to the body? Which problems can be expected with
this approach? Is window.setTimeout(code, 0) equivalent, as long as
setTimeout is available, and order of execution doesn't matter? I don't
mind doing research, but I do mind the "I know, but I won't tell" attitude.


- Conrad
.



Relevant Pages

  • Re: Ask EU: 42 days detention
    ... what the limit for habeas corpus used to be originally, but IIRC it was ... nearer three days than three months. ... Bear in mind that, as far as I know, no terror suspect has even had to ...
    (uk.media.radio.archers)
  • classics...
    ... RD500 YPVS. ... Mind, he's put a thundercat (IIRC) front end on it... ...
    (uk.rec.motorcycles.classic)
  • Re: Depths of the Ocean
    ... 50 million tons of seawater a day IIRC. ... Mind you, if you're talking "nonsensical ravings of a lunatic mind", ...
    (uk.rec.sheds)
  • Re: Small footprint RTOS for embedded system
    ... FreeRTOS and XMK are two that come to mind: ... IIRC, they both impose requirements that you offer to supply ...
    (comp.arch.embedded)
  • Re: Has Des Perked up ?
    ... To my mind anyway. ... So maybe it was just a bout of flu after all. ... That's IIRC, IIRC. ...
    (uk.media.tv.misc)

Loading