navigator.geolocation.getCurrentPosition sometimes works sometimes doesn't

前端 未结 25 1907
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 13:33

So I have a pretty simple bit of JS using the navigator.geolocation.getCurrentPosition jammy.

$(document).ready(function(){
  $(\"#business-locate, #people-l         


        
25条回答
  •  悲&欢浪女
    2020-11-22 14:22

    I have this problem in Mozilla. All time: Error: Unknown error acquiring position.

    Now i'm using 47 Mozilla. I have tried everything, but all time this problem. BUT then i open about:config in my addsress bar, go geo.wifi.ui and changed it value to "https://location.services.mozilla.com/v1/geolocate?key=test". works!

    If u have Position acquisition timed out error, try to increase timeout value:

    var options = {
      enableHighAccuracy: true,
      timeout: 5000,
      maximumAge: 0       
    };
    navigator.geolocation.getCurrentPosition(success, error, options);
    

提交回复
热议问题