navigator.geolocation.getCurrentPosition always fail in chrome and firefox

后端 未结 7 806
予麋鹿
予麋鹿 2020-12-16 02:04

I got strange behavior when I tried to test my \"navigator.geolocation.getCurrentPosition\" web page. Here is my testing result and code:

my code:

fu         


        
7条回答
  •  旧时难觅i
    2020-12-16 02:24

    I had same issue and solution was to increase the timeout duration as mobile network are slower than wired network

     {timeout: 30000, enableHighAccuracy: true, maximumAge: 75000}
    

    along with enabling cellular positioning

    In the Device Settings turn on "Wifi and Cellular positioning" option.

提交回复
热议问题