From da1808bb329787c7250b235b2a43054f0360f27e Mon Sep 17 00:00:00 2001 From: Norbert Renner Date: Fri, 31 Aug 2018 14:24:43 +0200 Subject: [PATCH] Only add location control in secure context (#60) --- js/Map.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/Map.js b/js/Map.js index f24b511..6f2793c 100644 --- a/js/Map.js +++ b/js/Map.js @@ -128,10 +128,13 @@ BR.Map = { layersControl = BR.layersTab(baseLayers, overlays).addTo(map); - L.control.locate({ - icon: 'fa fa-location-arrow', - iconLoading: 'fa fa-spinner fa-pulse', - }).addTo(map); + var secureContext = 'isSecureContext' in window ? isSecureContext : location.protocol === 'https:'; + if (secureContext) { + L.control.locate({ + icon: 'fa fa-location-arrow', + iconLoading: 'fa fa-spinner fa-pulse', + }).addTo(map); + } L.control.scale().addTo(map);