0

I am searching for solution, how to reload tile in leaflet.js which is not loaded due error 503. Thank you

2

1 Answer 1

2

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
    }
 });
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.