Answer the question
In order to leave comments, you need to log in
How to change the name of the city depending on where the visitor is located?
The site lists the city as take.ms/5D8ez , and it is necessary to change the name of the city depending on where the visitor is located. Maybe someone knows how this is done.
Answer the question
In order to leave comments, you need to log in
Thanks who helped. found a simple solution using Yandex
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script charset="utf-8" src="http://api-maps.yandex.ru/1.1/index.xml?key=API-ключ" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
if (YMaps.location.city != '') {
$('.country span').html(YMaps.location.country);
$('.region span').html(YMaps.location.region);
$('.city span').html(YMaps.location.city);
}
else {
$('.title').html('Яндекс ничего не вернул.');
}
});
</script>
You need to cut GeoIP. The bases are available for free, but they are not very good, there are also paid services.
And the principle is something like this: a client visits the site, you pull his IP and search the database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question