0
I’m using Windows with a virtualhost and I need to make the map work on the localhost, only I already have the google key and even so, without putting the appropriate restrictions on the key still appears the message. How do I get the map to work in the localhost environment? Follow 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());
}
you released the localhost url in the google api console?
– mcamara
How do you do that?
– Felipe Michael da Fonseca
Accesses https://console.developers.google.com, within the Credentials tab you click on the generated credential and add localhost as a trusted test URL!
– mcamara
But there are only key restriction options
– Felipe Michael da Fonseca