Skip to content

Instantly share code, notes, and snippets.

@Pent
Created May 25, 2013 18:05
Show Gist options
  • Select an option

  • Save Pent/5650108 to your computer and use it in GitHub Desktop.

Select an option

Save Pent/5650108 to your computer and use it in GitHub Desktop.
geolocation in meteor
client.js ------
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
Session.set('lat', position.coords.latitude);
Session.set('lon', position.coords.longitude);
}, function(error) {
}, { enableHighAccuracy: true });
}
Template.userLayout.location = function () {
return Session.get('lat') + " : " + Session.get('lon');
};
app.html ------
<template name="userLayout">
<div>{{location}}</div>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment