Version:
Popular examples
Map
Geo objects
Balloon and hint
Controls
Hotspots
Clustering
GeoQuery
Behaviors and events
Search on a map
Traffic
User's location
Routing
YMapsML
GeoXML
ObjectManager
Modular system
Panoramas
External modules

Adding the "Geolocation" button

Save as filesEdit on JSFiddle

In API 2.0 versions, to determine the location by IP or by using the Geolocation API, developers had to independently use the necessary methods and process the result (see the example).

The API 2.1 has a special built-in "geolocation" control, which allows you to display the user's location on the map. This control is implemented by the control.GeolocationControl class, which corresponds to the 'geolocationControl' key.

To add a control to the map, you just need to specify the appropriate key in the map parameters.

Пишете на JavaScript? У нас есть вакансии
Mon Oct 31 2022 13:07:25 GMT+0300 (Moscow Standard Time)