From bcc288d880e4e76154da66c9eb4a8e25367bfc6c Mon Sep 17 00:00:00 2001 From: Deryck Hodge Date: Fri, 26 Aug 2005 21:58:57 +0000 Subject: r9668: Cross-browser fix for IE, when adding scripts on the fly. deryck (This used to be commit 1f4e65ce96ec8c4335bfabbe54989a8cb431d773) --- swat/scripting/client/js_scripts.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/swat/scripting/client/js_scripts.js b/swat/scripting/client/js_scripts.js index 776e5e4ded..1c6e5806f4 100644 --- a/swat/scripting/client/js_scripts.js +++ b/swat/scripting/client/js_scripts.js @@ -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) -- cgit