Commit f7aee74a authored by Dmytrii's avatar Dmytrii

x1092 Fallback to default location if it was not received from external service

If end-user uses adblock or other extension and access to ip-api.com is blocked
map will apper gray it will not be possible to do anything with it.
If that happens we need to set default location and zoom out for better view.
parent 4b7828a1
...@@ -151,6 +151,8 @@ ...@@ -151,6 +151,8 @@
// look up user's location by IP address // look up user's location by IP address
$.getJSON("http://ip-api.com/json/?callback=?", function(data) { $.getJSON("http://ip-api.com/json/?callback=?", function(data) {
map.setView([data["lat"], data["lon"]], 12); map.setView([data["lat"], data["lon"]], 12);
}).fail(function() {
map.setView([0, 0], 1)
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment