草庐IT

latitudeAndLongitude

全部标签

javascript - 使用 javascript 获取我当前的地址

我对使用Javascript获取我当前的地址很感兴趣,只是通过组装其他一些SO线程(1,2)来解决这个问题,所以想发布这个问题和答案。请参阅下面的答案。 最佳答案 这是HTML:这是JS:varlatitudeAndLongitude=document.getElementById("latitudeAndLongitude"),location={latitude:'',longitude:''};if(navigator.geolocation){navigator.geolocation.getCurrentPosition(