-1

I am trying to use this code(below) it is working fine on Microsoft edge but not on chrome, how to I get it to work on chrome?

$(document).ready(function() {

    $("button").click(function() {

        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(showPosition);
        }

        function showPosition(position) {
            $("p").append("Latitude: " + position.coords.latitude +
                "<br>Longitude: " + position.coords.longitude);
        }

    });

});

In chrome it even prompts to allow the location but it doesn't show the coordinates.

Thanks

Ataur Rahman Munna
  • 3,887
  • 1
  • 23
  • 34
Vamsiga
  • 3
  • 3
  • Additionally to the duplicate question please also read https://developers.google.com/web/updates/2016/04/geolocation-on-secure-contexts-only – dirkk Aug 06 '17 at 09:54

1 Answers1

0

Because the security reason they stop in HTTP. its work only in HTTPS

Anju
  • 23
  • 5