You can use Yandex API. In this example, two scripts are loaded: ymaps and jQuery for convenience. When ymaps loaded, a ymaps object of the same name appears in the global context. From it, you can get what you need. For example, a city: ymaps.geolocation.city . Or region: ymaps.geolocation.region . It's simple! You can also print the console.log(ymaps); object in the console.log(ymaps); and see all its properties and methods.
<script src="http://yastatic.net/jquery/2.1.1/jquery.min.js"></script> <script src="http://api-maps.yandex.ru/2.0-stable/?load=package.standard&lang=ru-RU" type="text/javascript"></script> <script type="text/javascript"> window.onload = function () { jQuery("#user-city").text(ymaps.geolocation.city); jQuery("#user-region").text(ymaps.geolocation.region); jQuery("#user-country").text(ymaps.geolocation.country); } </script> <div id="user-city"></div> <div id="user-region"></div> <div id="user- country"></div>