Be io ho questo preso direttamente dal google platform:
non mi sembra che ci sia qualcosa di sbagliato o no?codice:<script src="https://maps.googleapis.com/maps/api/js?key=xxxxxxxxxxxxxxxxxxxxxxxxxxxx&callback=initMap" async></script> <script> function cercaGps() { var startPos; var geoOptions = { maximumAge: 5 * 60 * 1000, timeout: 10 * 1000 } var geoSuccess = function(position) { startPos = position; var coords = new google.maps.LatLng(startPos.coords.latitude, startPos.coords.longitude); calcolaLocazionePiuVicina(coords); }; var geoError = function(error) { cercaGps(); } navigator.geolocation.getCurrentPosition(geoSuccess, geoError, geoOptions); return; } cercaGps(); </script>

Rispondi quotando
