I am searching for solution, how to reload tile in leaflet.js which is not loaded due error 503. Thank you
1 Answer
Looking at the API I put this code together which should help you solve the problem:
function reloadImg() { // reload image by changing its src
var src = $(this).attr("src");
var i = src.lastIndexOf('?');
if(i > 0) { // remove previous cache string
src = src.substring(0, i);
}
$(this).attr("src", src + "?nocache=" + (Math.random() * 1000));
}
map.on('layeradd', function(ILayer) { // on adding a new tile
if($.isFunction(ILayer.layer.getContainer)) { // get the container holding the images
$("img", ILayer.layer.getContainer()).error(reloadImg); // apply error handling event
}
});
leaflet reload tiles
gave me stackoverflow.com/questions/15048096/…