[GIS] How to prevent Leaflet from loading tiles from server

cachefirefoxjavascriptleaflettiles

I am currently developing a couple of solutions with LeafletJS and it frustrates me that my Firefox browser loads the tiles from the server (e.g. Stamen or OSM) and not from cache every time I reload the page (I only reload the page to run my latest js code, not to see fresh tiles).

I used to work with OpenLayers and didn't have that issue – on the contrary, I added some extra code to force OL to get fresh tiles in specific cases.

I have Leaflet version 0.7.3 and Firefox version 38.0 on Linux Mint Mate 17.1 64 bit.

Best Answer

This probably has nothing to do with Leaflet — it requests tile images the same way as other JS libraries, and caching is fully handled by the browser. Check your browser/devtools settings.