function?justify_location(){
???????if(navigator.geolocation)?{
???????????//?支持
???????????console.log("支持地理位置接口");
???????}?else?{
???????????//?不支持
???????????console.log("不支持地理位置接口");
???????}
???}
????function?agree_obtain_location(){
???????var?option?=?{
???????????enableHighAccuracy?:?true,
???????????timeout?:?Infinity,
???????????maximumAge?:?0
???????};
???????navigator.geolocation.getCurrentPosition(geoSuccess,geoError,option);
???}
???function?geoSuccess(event)?{
???????console.log(event.coords.latitude?+?',?'?+?event.coords.longitude);
???????lat=event.coords.latitude;
???????lng=event.coords.longitude;
???????console.log(lat,lng)
???}
???function?geoError(event)?{
???????console.log("Error?code?"?+?event.code?+?".?"?+?event.message);
???}
???justify_location();
???agree_obtain_location();用這個方法,不穩(wěn)定,有時候可以,有時候不行,打包成app也不可以了,請問有什么好的穩(wěn)定的方法呢~~?
h5獲取經(jīng)緯度有問題
陌上人如玉_010
2017-06-20 10:04:31