Skip to main content
Post Closed as "Not suitable for this site" by IvanSanchez, Vince, Kadir Şahbaz, dmci, Gabriel De Luca
code indentation
Source Link
IvanSanchez
  • 10.3k
  • 2
  • 20
  • 35

I have the following that prompts the user to give location access. On granting permission the user's location is shown and the map loads. I'm trying to find a solution for if the user accidentally denies location access. Can anyone advise?

 function onLocationFound(e) {
        var radius = e.accuracy / 4;

        L.circle(e.latlng, radius).addTo(map);
    }

    function onLocationError(e) {
        alert(e.message);
    }

    map.on('locationfound'"locationfound", onLocationFound);
    map.on('locationerror'"locationerror", onLocationError);

    map.locate({ setView: true, maxZoom: 16 });

I have the following that prompts the user to give location access. On granting permission the user's location is shown and the map loads. I'm trying to find a solution for if the user accidentally denies location access. Can anyone advise?

 function onLocationFound(e) {
        var radius = e.accuracy / 4;

        L.circle(e.latlng, radius).addTo(map);
    }

    function onLocationError(e) {
        alert(e.message);
    }

    map.on('locationfound', onLocationFound);
    map.on('locationerror', onLocationError);

    map.locate({setView: true, maxZoom: 16});

I have the following that prompts the user to give location access. On granting permission the user's location is shown and the map loads. I'm trying to find a solution for if the user accidentally denies location access. Can anyone advise?

function onLocationFound(e) {
  var radius = e.accuracy / 4;

  L.circle(e.latlng, radius).addTo(map);
}

function onLocationError(e) {
  alert(e.message);
}

map.on("locationfound", onLocationFound);
map.on("locationerror", onLocationError);

map.locate({ setView: true, maxZoom: 16 });
naming
Link
Vince
  • 20.3k
  • 16
  • 48
  • 65

leaflet Leaflet geolocation alternative for if access is denied

Source Link

leaflet geolocation alternative for if access is denied

I have the following that prompts the user to give location access. On granting permission the user's location is shown and the map loads. I'm trying to find a solution for if the user accidentally denies location access. Can anyone advise?

 function onLocationFound(e) {
        var radius = e.accuracy / 4;

        L.circle(e.latlng, radius).addTo(map);
    }

    function onLocationError(e) {
        alert(e.message);
    }

    map.on('locationfound', onLocationFound);
    map.on('locationerror', onLocationError);

    map.locate({setView: true, maxZoom: 16});