navigator.geolocation.GetCurrentPosition throws “The last location provider was disabled” error
问题 I am trying to create a very basic HTML5 page that grabs the geolocation, but I'm getting an error. Here's what I have inside my 'script' tags: function GetGeo() { if (!navigator.geolocation) { alert("Could not find geolocation"); } else { navigator.geolocation.getCurrentPosition(showMap, function (error) { alert("error encountered: " + error.message ); }); } } function showMap(position) { window.alert(position.coords.latitude + ", " + position.coords.longitude); } The page just has a button