developer documentation r21357

fm.geolocation

fm.geolocation.getCurrentPosition(successCallback, errorCallback, options)

This function is a simple wrapper around the W3C Geolocation api.

The function will either call the native browser's geolocation api, which is currently supported by Firefox 3.5, or it will call Google Gears, if it is installed.

The main benefit of using this function is that it will gracefully degrade if neither of these libraries are available.

Check out the actual specification for more information about the arguments and options. We currently only support the getCurrentPosition function, but we might add more functions in the future if there is demand.

Example

fm.geolocation.getCurrentPosition( function(position) { alert('Your position is : ' + position.coords.latitude + ',' + position.coords.longitude); }, function(error) { alert('An error happened while detecting your position, or no geolocation api was detected.'); } );
<< 9.4 fm.util