Getting Users geolocation data

#1

Hi fam, anyone know how to get location data with code? I’m trying to run below but getting script error navigator is not defined

if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$("#{{ask_a_question_2.choice}}").html(“latitude:” + position.coords.latitude + “
longitude:” + position.coords.longitude);
});
}

(Daniel Beckett) #2

Hi @Omoshx78

We’re a bit limited in what code advice we can offer but I believe that something like navigator.geolocation would only work on a web page and not as part of our code service which only supports basic JavaScript.

1 Like