3 回答
TA贡献1998条经验 获得超6个赞
navigator.geolocation.getCurrentPosition(successCallback,errorCallback,{timeout:10000});
TA贡献1868条经验 获得超4个赞
if (navigator.geolocation) { var location_timeout = setTimeout("geolocFail()", 10000); navigator.geolocation.getCurrentPosition(function(position) { clearTimeout(location_timeout); var lat = position.coords.latitude; var lng = position.coords.longitude; geocodeLatLng(lat, lng); }, function(error) { clearTimeout(location_timeout); geolocFail(); });} else { // Fallback for no geolocation geolocFail();}
TA贡献1824条经验 获得超6个赞
navigator.geolocation.getCurrentPosition(getCoor, errorCoor, {maximumAge:60000, timeout:5000, enableHighAccuracy:true});
添加回答
举报