From: Michael J. Rubinsky Date: Mon, 21 Jun 2010 15:43:35 +0000 (-0400) Subject: Always use document.write to output script tags, regardless of useragent. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=acfdb0ec17941f6c56aa6d7ce0d136e690422ec8;p=horde.git Always use document.write to output script tags, regardless of useragent. inserting scripts into the dom breaks things when using horde's static javascript caching. --- diff --git a/horde/js/hordemap/map.js b/horde/js/hordemap/map.js index a51169a1f..65f650358 100644 --- a/horde/js/hordemap/map.js +++ b/horde/js/hordemap/map.js @@ -72,25 +72,14 @@ HordeMap = { _includeScripts: function() { var files = this._includes; - var agent = navigator.userAgent; - var docWrite = (agent.match("MSIE") || agent.match("Safari")); + + // Need to use document.write instead of inserting into DOM directly + // to play nice with horde's javascript caching/loading var writeFiles = []; for (var i = 0, len = files.length; i < len; i++) { - if (docWrite) { - writeFiles.push(''); - } else { - var s = document.createElement("script"); - s.src = files[i]; - var h = document.getElementsByTagName("head").length ? - document.getElementsByTagName("head")[0] : - document.body; - h.appendChild(s); - } - } - - if (docWrite) { - document.write(writeFiles.join("")); + writeFiles.push(''); } + document.write(writeFiles.join("")); }, _addScript: function(s)