navigator.geolocation.getCurrentPosition always fail in chrome and firefox

后端 未结 7 802
予麋鹿
予麋鹿 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:22

    You need to be using https, not http.

    The Chrome reference for this is here - https://developers.google.com/web/updates/2016/04/geolocation-on-secure-contexts-only

提交回复
热议问题