From 634588abf0a6fea96f867fdf6db50743be98a8ee Mon Sep 17 00:00:00 2001 From: crschmidt Date: Tue, 3 Oct 2006 14:11:43 +0000 Subject: [PATCH] If we're not running under IE, we should append script tags via the DOM. This works in Safari, Firefox, Opera, and we check for IE and do it the old way for them. Closes #177 . git-svn-id: http://svn.openlayers.org/trunk/openlayers@1540 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index c8f80cf6ae..a2f0463497 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -108,9 +108,18 @@ if (typeof(_OPENLAYERS_SFL_) == "undefined") { catch (e) { start=0; } for (var i = start; i < jsfiles.length; i++) { - var currentScriptTag = ""; - allScriptTags += currentScriptTag; + if (/MSIE/.test(navigator.userAgent)) { + var currentScriptTag = ""; + allScriptTags += currentScriptTag; + } else { + var s = document.createElement("script"); + s.src = host + jsfiles[i]; + var h = document.getElementsByTagName("head").length ? + document.getElementsByTagName("head")[0] : + document.body; + h.appendChild(s); + } } - document.write(allScriptTags); + if (allScriptTags) document.write(allScriptTags); })(); }