Is there a way of detecting whether a user has already given permission to use navigator.geolocation?

前端 未结 3 530
余生分开走
余生分开走 2020-12-09 10:11

Apart from setting a cookie the first time round, is there a way of detecting whether a user has already given permission for navigator.geolocation to return the lat/long of

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-09 10:56

    Please see this answer on how to do it using the Permissions API: Check if Geolocation was allowed and get Lat Lon

    Works without prompting the user if permission was granted previously.

提交回复
热议问题