]> git.samba.org - mat/samba.git/commitdiff
r9668: Cross-browser fix for IE, when adding scripts on the fly.
authorDeryck Hodge <deryck@samba.org>
Fri, 26 Aug 2005 21:58:57 +0000 (21:58 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:34:38 +0000 (13:34 -0500)
deryck
(This used to be commit 1f4e65ce96ec8c4335bfabbe54989a8cb431d773)

swat/scripting/client/js_scripts.js

index 776e5e4ded2f1b5e68459d2a003f73cf15418f39..1c6e5806f4cb3929ffb28206277a4a0e88155c29 100644 (file)
@@ -32,10 +32,17 @@ function __get_js_script(file)
 
 function __add_js_script(path)
 {
+       // Create a unique ID for this script
+       var srcID = new Date().getTime();
+
        var script = document.createElement('script');
-       script.setAttribute('type', 'text/javascript');
-       script.setAttribute('src', path);
+       script.type = 'text/javascript';
+       script.id = srcID;
+
        head.appendChild(script);
+
+       // IE works only with the path set after appending to the document
+       document.getElementById(srcID).src = path;
 }
 
 function __remove_js_script(path)