Re: Dynamic loading of javascript files into web pages



On Jun 29, 4:32 pm, Conrad Lender <crlen...@xxxxxxxxx> wrote:
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.

You said you were using them as well, which is not acceptable.


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

Not really.

much, and is frequently asked, it should probably go in the FAQ, which

Tell the FAQ maintainer.

would save people from sifting through thousands of posts containing
half-solutions and esoteric cases every time.

I told you whose posts to read. Skip to the end.


Is it really too much to ask which is the "recommended" approach? Is it

I told you.

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

That's one of three ways and you have to feature test to determine
which will succeed (if any.) I know I mentioned in this thread that
there is a method in My Library for this. Just type "browser
scripting library" into your favorite search engine (it's invariably
the top result.)

this approach? Is window.setTimeout(code, 0) equivalent, as long as
setTimeout is available, and order of execution doesn't matter?

Of course not. For one, the idea is to execute the script
immediately.

I don't
mind doing research, but I do mind the "I know, but I won't tell" attitude.

That attitude is in all in your head. You could search the archive,
see my example, Google for Randy's examples, etc. In browser time,
this is all ancient history. It's not up to others to give you
answers on a silver platter either (this is not a help desk.)
.



Relevant Pages

  • Re: A long ramble
    ... So I ask you, with your cut and run attitude, that is, when somthing ... Roger's rigid mind is made up. ... him that any injury or failing of the body is his always mind's fault. ... I was too lazy to exercise properly to keep my body strong. ...
    (rec.boats.cruising)
  • Re: Zarbiface - finally gone?
    ... I have seen in this group (mind you is that what is known as damning ... just as he has with his "What's a mullet" question. ... Seeing as I can only see Zarbs replies when quoted I will clarify ... His particulalrly unpleasant and obnoxious attitude when someone ...
    (rec.arts.drwho)
  • Re: C# static, is this correct?
    ... > Hello guys, in C#, is using "static" would be the most proper way to ... just came to my mind that there might be a better or more ... > this practice slows down execution? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Civil War 4 SPOILERS
    ... I can't tell if Tony's on the sauce, or fighting mind control, because while he did show some remorse for Goliath, his attitude with Captain America almost makes that Null and void. ...
    (rec.arts.comics.marvel.universe)
  • Re: Looping!
    ... Dim strSQL1,strSQL2 ... There's another doubt I have in my mind. ... On subsequent code execution, the ... Actually I have never worked with Preserving & Erasing array items; ...
    (microsoft.public.inetserver.asp.db)