GMaps.js supports HTML5 Geolocation:
GMaps.geolocate({ success: function(position) { map.setCenter(position.coords.latitude, position.coords.longitude); }, error: function(error) { alert('Geolocation failed: '+error.message); }, not_supported: function() { alert("Your browser does not support geolocation"); }, always: function() { alert("Done!"); } });
GMaps.geolocate
supports 4 functions:
success
(required): fires when geolocation has been successfulerror
(required): fires when geolocation has not been donenot_supported
(required): fires when geolocation is not supported by the browseralways
(optional): fires always after every scenario described above.