navigator.geolocation.getCurrentPosition always fail in chrome and firefox

后端 未结 7 757
予麋鹿
予麋鹿 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条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-16 02:33

    I know this is old topic but recently I had this error also:

    message: "Network location provider at 'https://www.googleapis.com/' : Returned error code 404.", code: 2

    The fix is to get api key for google maps and use it in your code

    Here you can get API KEY: https://developers.google.com/maps/documentation/javascript/get-api-key#key

提交回复
热议问题