Tutorialsplane

Vue.js Get Geolocation


We can use navigator geolocation property to get the current location of visitor(user) in JavaScript. You can use the same native JavaScript geolocation property in Vue.js.


Vue.js Get Geolocation | Lat | Lon Example

Using geolocation property we can get user’s lattitude and longitude. You can use navigator geolocation property in Vue.js Simply as below-

Example:

<div id="app">
	<p>Lat = {{lat}} Lon ={{lon}}</p>
	<p>{{error}}</p>
	<button>Click Me</button>
</div>
   

Try it »

Note : This property works with SSL enabled urls.
Note : This property supports read only.