Dear list,<br><br>I have a problem on pink tiles showing up in FireFox. The are generated because of too many connection. It's OK that they are displayed. The problem is that when I zoom out and zoom in they don't disappear as they should. This is because of aggressive caching on tile to be displayed. If I disable caching on server side for tiles, the behave ok... bu I want tiles to be able to cache them on clients!<br>
<br>After some days thinking about it I decided to inspect OL code.<br>I realized that the problem is related to "<b>OpenLayers.Util.onImageLoadError</b>". In fact if I change it in tha following way, firefox will reload missing tiles after a refresh:<br>
<br><span style="font-family: courier new,monospace;">OpenLayers.Util.onImageLoadError = function() {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> this._attempts = (this._attempts) ? (this._attempts + 1) : 1;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if (this._attempts <= OpenLayers.IMAGE_RELOAD_ATTEMPTS) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> var urls = this.urls;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if (urls && urls instanceof Array && urls.length > 1) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> var src = this.src.toString();</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> var current_url, k;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> for (k = 0; current_url = urls[k]; k++) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if (src.indexOf(current_url) != -1) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> break;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> var guess = Math.floor(urls.length * Math.random());</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> var new_url = urls[guess];</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> k = 0;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> while (new_url == current_url && k++ < 4) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> guess = Math.floor(urls.length * Math.random());</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> new_url = urls[guess];</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> this.src = src.replace(current_url, new_url);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> } else {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> this.src = this.src;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> OpenLayers.Console.log("attemp n.:",this._attempts);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> } else {</span><br style="font-family: courier new,monospace;"><font size="4"><span style="font-family: courier new,monospace;"> <b>OpenLayers.Console.log("error loading", "appending uuu!");</b></span><b><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> this.src = this.src + "&uuu";</span></b><br style="font-family: courier new,monospace;"></font><span style="font-family: courier new,monospace;"> this.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> this.style.display = "";</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">};</span><br style="font-family: courier new,monospace;"><br>That is: I change the the url of the tile appending some dummy character [in this case "uuu", but it can be anything].<br>
It's not a general solution, because it should be, perhaps, checked that there is a query string before appending... perhaps not, because the <b>src </b>will not be used... <br><br>Pietro Ianniello<br>