<!-- !!! For correct work add site to White list of "Disconnect" Google Chrome extention -->

<br><br>
<div class="container">
  <div class="jumbotron">
    <h1>Geolocation Yandex Maps API</h1>

    <p id="user-country"></p>
    <p id="user-region"></p>
    <p id="user-city"></p>
  </div>
</div>
<script src="https://api-maps.yandex.ru/2.0-stable/?load=package.standard&lang=ru-RU"></script>
ymaps.ready(function() {

  if (typeof ymaps.geolocation.country != "undefined") {
    $('#user-country').text(ymaps.geolocation.country);
  } else {
    $('#user-country').text('Не удалось получить города =(');
  }

  if (typeof ymaps.geolocation.region != "undefined") {
    $('#user-region').text(ymaps.geolocation.region);
  } else {
    $('#user-region').text('Не удалось получить регион или область =(');
  }

  if (typeof ymaps.geolocation.city != "undefined") {
    $('#user-city').text(ymaps.geolocation.city);
  } else {
    $('#user-city').text('Не удалось получить город =(');
  }

  // $('#user-city').text(ymaps.geolocation.city);
  // $('#user-country').text(ymaps.geolocation.country);
  // $('#user-region').text(ymaps.geolocation.region);

});

External CSS

  1. https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css

External JavaScript

  1. //cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js