Quick Jump ↵
Geolocation support is turned off by default! The visitor's browser otherwise will notify them that your website would like to gather location information.
geo : { use : false
geo : { use : true
$m.construct()
When support is turned on, Magic immediately asks the visitor's browser for geolocation data. See below for more details.
By itself, the Magic's geolocation code doesn't provide more than simple functionality to ask the browser for location details. What you do with the data is up to you. Below is an example.
Show my geolocation data
If geolocation data is available, it will be saved to the $m.geo.pos object.
$m.geo.pos
$m.geo.pos.timestamp
$m.geo.pos.coords.latitude
$m.geo.pos.coords.longitude
$m.geo.pos.coords.accuracy
$m.geo.pos.coords.altitude
$m.geo.pos.coords.altitudeAccuracy
$m.geo.pos.coords.heading
$m.geo.pos.coords.speed
Any properties not available will be set to false.
false
« Back to the main documentation