Magic Icon Geolocation: Magic JavaScript

Quick Jump ↵

Usage

Geolocation support is turned off by default! The visitor's browser otherwise will notify them that your website would like to gather location information.

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.

Example

Show my geolocation data

API

If geolocation data is available, it will be saved to the $m.geo.pos object.

Any properties not available will be set to false.

« Back to the main documentation