E
E
Egor Rublev2017-02-03 12:01:44
JavaScript
Egor Rublev, 2017-02-03 12:01:44

YandexMaps Api location detection, how to solve the problem in FF?

The problem with the Cyrillic domain, in FF it gives undefined:
https://yadi.sk/i/XjX-jFwJ3CcuVs
I suspect a problem in the Cyrillic domain, how to solve it? Works in all other browsers.
Connected API 2.0

ymaps.ready(init);

function init() {

    var currentCity = ymaps.geolocation.city;
    $('#city').html(currentCity);
    console.log(currentCity);

}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Victor L, 2017-02-17
@Fzero0

<script src="//api-maps.yandex.ru/2.0/?load=package.standard&amp;lang=ru-RU" type="text/javascript"></script>
$(document).ready(function($) {
        ymaps.ready(init);
        function init() {
          var geolocation = ymaps.geolocation;
          if (geolocation) {
            $text_city = geolocation.country + ', ' + geolocation.region + ', ' + geolocation.city;
            //console.log($text_city);
            $("#city0").val($text_city);
            $("#city1").val($text_city);
            $("#city2").val($text_city);
            $("#city3").val($text_city);
            $("#city4").val($text_city);
            $("#city_call").val($text_city);
            $("#city_modreserve").val($text_city);
            $("#city_reserve").val($text_city);
          } else {
            console.log('Не удалось установить местоположение');
          }
        }
      });

and if so?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question