Hi all,
Using the latest version of Prototype, I'm trying to dynamically load
JavaScripts at runtime on demand, into the head or body tags (I don't
actually care which). The insert() method just seems to do nothing
when I specify a script tag containing a src attribute:
$$('body')[0].insert('<script type="text/javascript"
src="dynamic.js"></script>');
However, if I omit the src tag, instead using in-line JavaScript
inside the tag, it loads correctly:
$$('body')[0].insert('<script type="text/javascript">alert("foo");</
script>');
Is this some kind of browser security feature or a bug, or am I just
doing something goofy? I could get the contents of the file using a
server script but that would be a very dirty solution that I'd like to
avoid if possible.
Grateful for any advice received.
on 2008-07-05 12:09