Does mdg:geolocation work on desktop?


Or is it mobile only?

I need the lat and long of the user when they hit my landing page.


mdg:geolocation just leverages the Geolocation Web API that is already implemented in most modern browsers. So you don’t really need that package. For example, run the following in your Chrome console:

function success(position) {
  console.log('Latitude: ' + position.coords.latitude);
  console.log('Longitude: ' + position.coords.longitude);

function error() {
  console.log("Oh no - we can't find you!");

navigator.geolocation.getCurrentPosition(success, error);


Hey, @hwillson, how can I determine city based on lat and long?


You can use the reverse geocoding feature of Google’s Geocoding API to do this. Check out the reverse-geocoding npm package.