score:0

maybe are you facing to an error ?

geo.getcurrentposition(success, () => console.log('error happened !'));

score:1

navigator.geolocation has multiple drawbacks: it is not always available; it requires the user's consent; while doing so it displays an annoying pop-up; it uses approximation methods that are inconsistent and may give unexpected results; it required https, so it's hard to test on your local development server.

do you have the possibility to test an alternative, see if it works for you and if you don't have error anymore? i suggest a realtime api such as abstract ip location which is free.

you call the api omitting the ip_address parameter, so it returns the geolocation for the device making the api call. in the response, you get the longitude and latitude fields you can use to display the map's marker.


Related Query

More Query from same tag