tweaking the dynamic script tag adding bit (closes #1092).
git-svn-id: http://svn.openlayers.org/trunk/openlayers@5411 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+10
-9
@@ -179,15 +179,16 @@
|
|||||||
"OpenLayers/Control/EditingToolbar.js"
|
"OpenLayers/Control/EditingToolbar.js"
|
||||||
); // etc.
|
); // etc.
|
||||||
|
|
||||||
|
var agent = navigator.userAgent;
|
||||||
|
var docWrite = (agent.match("MSIE") || agent.match("Safari"));
|
||||||
var allScriptTags = "";
|
if(docWrite) {
|
||||||
|
var allScriptTags = new Array(jsfiles.length);
|
||||||
|
}
|
||||||
var host = OpenLayers._getScriptLocation() + "lib/";
|
var host = OpenLayers._getScriptLocation() + "lib/";
|
||||||
|
|
||||||
for (var i = 0; i < jsfiles.length; i++) {
|
for (var i = 0; i < jsfiles.length; i++) {
|
||||||
if (/MSIE/.test(navigator.userAgent) || /Safari/.test(navigator.userAgent)) {
|
if (docWrite) {
|
||||||
var currentScriptTag = "<script src='" + host + jsfiles[i] + "'></script>";
|
allScriptTags[i] = "<script src='" + host + jsfiles[i] +
|
||||||
allScriptTags += currentScriptTag;
|
"'></script>";
|
||||||
} else {
|
} else {
|
||||||
var s = document.createElement("script");
|
var s = document.createElement("script");
|
||||||
s.src = host + jsfiles[i];
|
s.src = host + jsfiles[i];
|
||||||
@@ -197,8 +198,8 @@
|
|||||||
h.appendChild(s);
|
h.appendChild(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (allScriptTags) {
|
if (docWrite) {
|
||||||
document.write(allScriptTags);
|
document.write(allScriptTags.join(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user