Methods to access geolocalization information about the client.
Get the current geolocalization information of the client.
parameters
parameters
Object
Parameters for the current request.
[selector]
String|jQueryObject|DOMElement
Optional
Element used to show status messages.
[lang = CURRENT_ENV_LANG]
String
Optional
A two character language code.
[success]
Function
Optional
Callback triggered when geolocalization informations have been successful retrieved. An object containing the informations is passed as the first argument.
[error]
Function
Optional
Callback triggered on geolocalization errors. The error message is passed as the first argument.
[options]
Object
Optional
Options given to optimize getCurrentPosition.
kafe.geolocation.locate({
selector: '#GeoLocStatus', lang: 'en',
success: function(coords) {
console.log('latitude: ' + coords.latitude);
console.log('longitude: ' + coords.longitude);
}
error: function(msg) {
console.log('Cannot geoloc: ' + msg);
},
options: {
enableHighAccuracy: false,
timeout: 5000,
maximumAge: 0
}
});
$('#GeoLocStatus').kafe('geolocation.locate', {});