diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index 1a96d2bccf..c1c191a8ec 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -274,9 +274,19 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile.BackBufferable, { * url - {String} or undefined to hide the image */ setImgSrc: function(url) { - this.imgDiv.style.display = "none"; + var img = this.imgDiv; + img.style.display = "none"; + // Setting img.src to "about:blank" would cause a broken image icon in + // some browsers, but we only use it when style.display is set to + // "none", so we don't care. We need this to prevent old images or + // loading image placeholders to be shown when the image's display style + // is set to "" in the onImageLoad method, which is called just before + // the image is rendered in some browsers. Note that setting img.src to + // "" would cause a request for the current page location being sent to + // the server in most browsers. + img.src = "about:blank"; if (url) { - this.imgDiv.src = url; + img.src = url; } },