How to get the user’s street address, using navigator.geolocation and MapQuest

steinbring profile image Joe Steinbring Originally published at blog.jws.app on ・1 min read

Let’s say that you have a webform where you are collecting a user’s street address. You can save the user a few minutes by defaulting the value for them. In this example, we are using Vue.js, Axios, a MapQuest API, and navigator.geolocation to first get the latitude and longitude from the client and then send it off to MapQuest to get a physical address.

This example builds off of our earlier Axios / Vue.js 2 APIs 101 post. But you will notice that there is a methods property, now. The this.geolocation() function is then kicked off within mounted().

Have a question or comment? Drop it in the comments and I will try to help.

Posted on by:

steinbring profile

Joe Steinbring


I write PHP (mostly Laravel) and JavaScript (mostly Vue.js) by day and whatever interests me by night. I travel, have dogs, and enjoy playing with my ukulele.


markdown guide