Locate is a MooTools class that gives you access to the HTML5 geolocation API.
In my oppinion it is a little bit difficult to handle so I wrote this little class for MooTools.
Now you can access your vistors geolocation as long as his browser does support this feature.

How to use

First of all you need to include the MooTools Core and the Locate.js into your project <script type="text/javascript" src="js/mootools-core.js"></script>
<script type="text/javascript" src="js/Locate.js"></script>
With the basic options, it locates your vistor once on init mtlocate = new Locate({
  onError: function(error){
   $("coord").set('html', error);
  onLocate: function(position){
   $("coord").set('html', position.latitude+","+position.longitude);
Don't want directly start locating on init? No problem!
Here is an example of frequently check the position by the press of a button. var location = new Locate({
  loi: false

// start locating later in your code using this line
// you can also use location.locate();



If you use an iPhone or another mobile device supporting HTML5 geolocation, try moving around and watch the coordinates change