This example demonstrates how to create a map that is initially centered on the user's location.
The "get" method of the geolocation function is used for detecting the location. In the parameters, you can set the preferred method of
location detection (by IP or using the Geolocation API), the time to wait for a response, and so on.
For more information, see the description of the method.
When calling this method, the browser tries to determine the geographical position of the user. If successful,
the result is written in the geoObjects map field; otherwise, there is an error message.
In this example, if the location cannot be detected, a map is created with the center in Moscow.
This example demonstrates how to create a map that is initially centered on the user's location.
The "get" method of the geolocation function is used for detecting the location. In the parameters, you can set the preferred method of location detection (by IP or using the Geolocation API), the time to wait for a response, and so on. For more information, see the description of the method.
When calling this method, the browser tries to determine the geographical position of the user. If successful, the result is written in the geoObjects map field; otherwise, there is an error message.
In this example, if the location cannot be detected, a map is created with the center in Moscow.