1

I am making a app project with Openlayers 3. There are several pages which all use map. So I want to write tile to local storage when the user operate some map. When the user operate the map of the next page, I want to first search the local storage to find cached tiles, if not, get the tiles from online.

Jose Gómez
  • 3,110
  • 2
  • 32
  • 54
JiaoXN
  • 65
  • 6

1 Answers1

0

If you have a small number of tiles, you can use the HTML5 appcache:

Just add a reference in your html file:

<html manifest="example.appcache">
  ...
</html>

Where example.appcache would contain the files to be cached:

CACHE MANIFEST
/theme.css
/logo.gif
/main.js 

Note that browsers may have different size limits for cached data (some browsers have a 5MB limit per site).

Whereas application cache is considered deprecated, its replacement, service workers, are not widely supported at the moment.

Jose Gómez
  • 3,110
  • 2
  • 32
  • 54