summaryrefslogtreecommitdiff
path: root/demo5.html
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2015-02-11 15:51:16 +0000
committerChristopher Baines <mail@cbaines.net>2015-02-11 15:51:16 +0000
commita134ed367d032ee8119aa3d3afece53cf44c77b9 (patch)
treea29e95ca438f710e7e3b472d3b20d596d91b5590 /demo5.html
parent46f880c5f8f506b686c66c45d1f64c9d3f75cb9c (diff)
downloadleaflet-workshop-a134ed367d032ee8119aa3d3afece53cf44c77b9.tar
leaflet-workshop-a134ed367d032ee8119aa3d3afece53cf44c77b9.tar.gz
Add a workaround to allow the demos to be used without a webserver
Diffstat (limited to 'demo5.html')
-rw-r--r--demo5.html8
1 files changed, 7 insertions, 1 deletions
diff --git a/demo5.html b/demo5.html
index 1e59063..d4f5f05 100644
--- a/demo5.html
+++ b/demo5.html
@@ -35,7 +35,13 @@
// Load some GeoJSON exported from OpenStreetMap using the OverpassAPI
// (http://overpass-turbo.eu/s/7yI)
- getJSON("cafes.json", function(cafes) {
+ var url = "cafes.json";
+
+ if (document.URL.indexOf("file") === 0) {
+ url = "http://cbaines.net/maptime/cafes.json";
+ }
+
+ getJSON(url, function(cafes) {
L.geoJson(cafes).addTo(map);
});