I've got an OpenLayers web application with a custom XYZ layer which downloads tiles from the server itself:

    OpenLayers.Layer.MOBAC_OSMDROID_ZIP = OpenLayers.Class(
              OpenLayers.Layer.XYZ, {
                  name: "tiles base",
                  transitionEffect: "resize",
                  sphericalMercator: true,
                  url: '../map/${z}/${x}/${y}.png',
                  [...]
              });

The funny thing here is that I can use MOBAC to download selected parts of OpenStreetMap and serve them from my website. So far, so good.

The problem is: obviously I do not want to download the whole world from OpenStreetMap, but only, for example, zoom levels 0 and 1 for the world, 2-4 for Europe, 5-7 for Spain and so on. Then, when I am zooming in to Spain I get the right tiles. But if I move outside Spain, I just get the damn pink "no-tile" image. I can easily remove such no-image with the .olImageLoadError CSS class... but it still does not show a map.

What I would like is: if there is no tile, use the previous tile, scaled. This way you will probably have an overview of where you are when there are no specific tiles for such level.

Any idea? Is something like this included in OpenLayers? Any idea to implement it myself?

Since the "resize" effect does not remove the old tiles for a while, maybe keeping them "forever" would work...