[OpenLayers-Trac] [OpenLayers] #2933: OpenLayers runs
HTML5-incompatible script
loading code if the UA string doesn't contain "Safari" or "MSIE"
OpenLayers
trac-20090302 at openlayers.org
Tue Nov 16 07:09:50 EST 2010
#2933: OpenLayers runs HTML5-incompatible script loading code if the UA string
doesn't contain "Safari" or "MSIE"
----------------------+-----------------------------------------------------
Reporter: hsivonen | Owner:
Type: bug | Status: new
Priority: critical | Milestone: 2.11 Release
Component: general | Version: 2.10
Keywords: | State:
----------------------+-----------------------------------------------------
OpenLayers has this bit:
var agent = navigator.userAgent;
var docWrite = (agent.match("MSIE") || agent.match("Safari"));
if(docWrite) {
var allScriptTags = new Array(jsfiles.length);
}
var host = OpenLayers._getScriptLocation() + "lib/";
for (var i=0, len=jsfiles.length; i<len; i++) {
if (docWrite) {
allScriptTags[i] = "<script src='" + host + jsfiles[i] +
"'></script>";
} 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);
}
}
if (docWrite) {
document.write(allScriptTags.join(""));
}
When docWrite is false, the code that is run doesn't work in browsers that
implement script loading and execution according to HTML5
(http://www.w3.org/TR/html5/scripting-1.html#running-a-script). This
includes Firefox 4 beta 7.
To make OpenLayers work in browsers that implement script loading and
execution according to HTML5 but that don't contain "MSIE" or "Safari" in
the UA string, please run the document.write()-based code path in all
browsers.
For more information, please see http://hsivonen.iki.fi/script-execution/
--
Ticket URL: <http://trac.openlayers.org/ticket/2933>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list