I use leaflet.offline which allows to save the tiles in indexedDB. The backup is done by a click on a button 'L.control'. I would like this backup to be automatic each time you start a map (without button). How to do it with leaflet.offline or do you know another way, please?
Layer creation - works fine
const tileLayerOffline = L.tileLayer.offline(
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
{
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
subdomains: "abc",
crossOrigin: true,
minZoom: 13,
maxZoom: 16,
}
)
Launch button
const controlSaveTiles = L.control.savetiles(tileLayerOffline, {
zoomlevels: [13, 16], // optional zoomlevels to save, default current zoomlevel
});
controlSaveTiles.addTo(map);