I am using this to load the client JavaScript for a web application
when it is selected by the user) via an Ajax connection to the server.
I have found only two ways of loading new JavaScript after the web page
is loaded.
1. Create a new script element (where head is the id of the head tag):
var s = document.create Element('script ');
s.setAttribute( 'type','text/javascript');
s.setAttribute( 'src', 'scripts/myscript.js');
s.setAttribute( 'defer', false);
document.getEle mentById('head' ).appendChild(s );
2. eval() of a string sent from the server via XmlHttpRequest.
The first method does not work with Apple Macintosh Safari. There is an
article on the apple support website
Does anyone know of any other methods that are cross-browser?
I already know about the IFrame workaround, but I have not been able to
determine if that is really portable and practical. Does anybody have
experience with this?
Thanks,
Gerard Vignes
Seattle, WA
when it is selected by the user) via an Ajax connection to the server.
I have found only two ways of loading new JavaScript after the web page
is loaded.
1. Create a new script element (where head is the id of the head tag):
var s = document.create Element('script ');
s.setAttribute( 'type','text/javascript');
s.setAttribute( 'src', 'scripts/myscript.js');
s.setAttribute( 'defer', false);
document.getEle mentById('head' ).appendChild(s );
2. eval() of a string sent from the server via XmlHttpRequest.
The first method does not work with Apple Macintosh Safari. There is an
article on the apple support website
Does anyone know of any other methods that are cross-browser?
I already know about the IFrame workaround, but I have not been able to
determine if that is really portable and practical. Does anybody have
experience with this?
Thanks,
Gerard Vignes
Seattle, WA
Comment