Is there any way to detect when loading fragments failed?

Is there a way to detect when the tile server cannot be contacted by OpenLayers? I want to display the error message "Tile server not found", and not only these ugly "images not found" red X-fragments.

+3
source share
2 answers

Just like FYI to everyone who needs to do this, I solved it with the following code (placed BEFORE I created my map, layers, etc.):

OpenLayers.Util.onImageLoadError = function () {
    this.src = "images/noTile.png";
}

where images / noTile.png is the image that I used as the "Tile not found" image.

+2
source

OpenLayers.Util.onImageLoadError, , . , CSS- , .olImageLoadError. ?

+1

All Articles