From 1f4e65ce96ec8c4335bfabbe54989a8cb431d773 Mon Sep 17 00:00:00 2001 From: Deryck Hodge Date: Fri, 26 Aug 2005 21:58:57 +0000 Subject: [PATCH] r9668: Cross-browser fix for IE, when adding scripts on the fly. deryck --- 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 776e5e4de..1c6e5806f 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) -- 2.34.1