Answer the question
In order to leave comments, you need to log in
Forwarding depending on the city?
There is a small script, I can't change it for automatic redirection.
<script src="http://yastatic.net/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
window.onload = function () {
if(ymaps.geolocation.region == 'Санкт-Петербург и Ленинградская область'){
jQuery(".region-city").text('spb.example.ru');
jQuery(".region-city-href").attr('href', 'http://spb.example.ru');
}
else if (ymaps.geolocation.region == 'Краснодарский край'){
jQuery(".region-city").text('krasnodar.example.ru');
jQuery(".region-city-href").attr('href', 'http://example.ru');
}
</script>
<script src="http://api-maps.yandex.ru/2.0-stable/?load=package.standard&lang=ru-RU" type="text/javascript"></script>
else if (ymaps.geolocation.region == 'Краснодарский край'){
jQuery(".region-city").text('krasnodar.example.ru');
jQuery(".region-city-href").header('Location: http://krasnodar.example.ru');
}
Answer the question
In order to leave comments, you need to log in
Instead of this
this
document.location.href="http://krasnodar.example.ru";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question