Google maps warning: getCurrentPosition () and watchPosition () no longer work on insecure origins

0

I'm using laravel with a virtualhost and I need to make the map work on localhost, but I already have the google key and even then, without putting the restrictions on the key, the message still appears. How do I make Map work in the localhost environment? Here is the location code that shows the message:

if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
    var pos = {
        lat: position.coords.latitude,
        lng: position.coords.longitude
    };

    infoWindow.setPosition(pos);
    infoWindow.setContent('Esta é a sua localização.');
    map.setCenter(pos);
}, function () {
    handleLocationError(true, infoWindow, map.getCenter());
});
} else {
    // Browser não suporta localização
    handleLocationError(false, infoWindow, map.getCenter());
}
    
asked by anonymous 19.07.2017 / 16:16

1 answer

1

I have already been through this problem in some tests that I did and I had to change it to access the screen (the whole site actually) via https .

reference: link

    
19.07.2017 / 16:25