I
I
Ivan Erokhin2022-02-14 13:42:51
JavaScript
Ivan Erokhin, 2022-02-14 13:42:51

How to get a user's geolocation?

I want to get the user's location. In general it works, but it doesn't work on new versions of ios in safari. Not even a prompt appears. In the phone settings, the geolocation is either enabled, or it's worth asking - it doesn't matter.

Here is a test case. On ios "User denied Geolocation"
https://codepen.io/dtkweb/pen/MWOmQBN

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dosya, 2022-02-15
@Dasihub

You can get the geolocation of the user with a ready-made Api via a fetch request here is the link https://geolocation-db.com/json/

I
Ivan Erokhin, 2022-02-15
@dero

Well, as far as I understood from Google, it simply does not work in new versions of ios.
Therefore, as an option, use third-party api to determine geolocation, but they will never give even an approximately similar option, like the built-in one.
For example, here is another api: https://geo.wpforms.com/v3/geolocate/json
Maybe it will come in handy for someone

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question