Re: Dynamic loading of javascript files into web pages
- From: David Mark <dmark.cinsoft@xxxxxxxxx>
- Date: Mon, 29 Jun 2009 13:48:56 -0700 (PDT)
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.)
.
- References:
- Dynamic loading of javascript files into web pages
- From: neilc
- Re: Dynamic loading of javascript files into web pages
- From: Peter Michaux
- Re: Dynamic loading of javascript files into web pages
- From: neilc
- Re: Dynamic loading of javascript files into web pages
- From: Jorge
- Re: Dynamic loading of javascript files into web pages
- From: Garrett Smith
- Re: Dynamic loading of javascript files into web pages
- From: Conrad Lender
- Re: Dynamic loading of javascript files into web pages
- From: Thomas 'PointedEars' Lahn
- Re: Dynamic loading of javascript files into web pages
- From: Conrad Lender
- Re: Dynamic loading of javascript files into web pages
- From: David Mark
- Re: Dynamic loading of javascript files into web pages
- From: Conrad Lender
- Dynamic loading of javascript files into web pages
- Prev by Date: Can call/apply be used to invoke constructor?
- Next by Date: Re: Can call/apply be used to invoke constructor?
- Previous by thread: Re: Dynamic loading of javascript files into web pages
- Next by thread: Re: Dynamic loading of javascript files into web pages
- Index(es):
Relevant Pages
|