0

Currently I am using leafletjs for showing maps. Is there a way I can detect browser offline or online status.

6
  • Thanks for the suggestion. But actually the leafletjs library internally calls osm.org in order to get the '.png' files. I see it call multiple urls with different sub domaine based based on the zoom level. for example a.osm.org/1/2/3 b.osm.org/2/4/5 and so on. Not sure if I can check the connectivity with a specific url ? As the url are continuously changing. Commented May 3, 2018 at 0:03
  • 1
    You can omit the subdomain, e.g. by using tile.openstreetmap.org/0/0/0.png instead of c.tile.openstreetmap.org/0/0/0.png. The subdomains are just used to trick the browser into creating more simultaneous connections than with a single domain, as far as I know.
    – scai
    Commented May 3, 2018 at 10:33
  • 1
    Re " leafletjs library internally calls osm.org in order to get the '.png' files" - not really; it fetches .png tiles from wherever you say they should come from. That might be OSM's own tiles (subject to the usage limits!) or can be anywhere you specify, such as local storage. Commented May 8, 2018 at 10:56
  • @scai Yep, I see I can simply call tile.openstreetmap instead of calling with subdomine. Commented May 8, 2018 at 23:22

0