From f93dce3b9b5074721ac42c1c94543fd5b7e58bf0 Mon Sep 17 00:00:00 2001 From: lokal-profil Date: Sun, 7 Sep 2014 15:07:01 +0200 Subject: [PATCH] Support https in geocoder This brings OSMGeocoder up to date with the original at https://github.com/k4r573n/leaflet-control-osm-geocoder This patch prevents 'locate' from throwing a "Blocked loading mixed active content" in firefox when using https. Fixes issue #7 --- leaflet/Control.OSMGeocoder.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/leaflet/Control.OSMGeocoder.js b/leaflet/Control.OSMGeocoder.js index 79bfde2..ed32989 100644 --- a/leaflet/Control.OSMGeocoder.js +++ b/leaflet/Control.OSMGeocoder.js @@ -99,7 +99,7 @@ L.Control.OSMGeocoder = L.Control.extend({ }, _isLatLon_decMin : function (q) { console.log("is LatLon?: "+q); - //N 53° 13.785' E 010° 23.887' + //N 53° 13.785' E 010° 23.887' //re = /[NS]\s*(\d+)\D*(\d+\.\d+).?\s*[EW]\s*(\d+)\D*(\d+\.\d+)\D*/; re = /([ns])\s*(\d+)\D*(\d+\.\d+).?\s*([ew])\s*(\d+)\D*(\d+\.\d+)/i; m = re.exec(q.toLowerCase()); @@ -171,7 +171,8 @@ L.Control.OSMGeocoder = L.Control.extend({ } } - var url = " http://nominatim.openstreetmap.org/search" + L.Util.getParamString(params), + var protocol = location.protocol; + var url = protocol + "//nominatim.openstreetmap.org/search" + L.Util.getParamString(params), script = document.createElement("script");