How to do a redirect to the mob.a version of the script?

There here is such a script, which runs the animation of roulette, and when roulette is scrolled, the button appears to pick up, it is necessary that the website was determined mob.version is sitting or not, and when you press the button, forwarded it to the mob.version if it with the phone whether it be for example 1234.php or pereadresovka it on the PC version 4333.php for example. How to implement it?
<center>
 <div id="roulette" class><div id="rouletteline"></div>
 <div class="roulette" style="overflow: visible; height: 220px;">

 <div class="roulette-inner" style="position: relative; top: 0px; transform: translate(0px, -1100px);"><img id="roll_img" src="files/1.png" style="display: block;"><img id="roll_img" src="files/2.png" style="display: block;"><img id="roll_img" src="files/3.png" style="display: block;"><img id="roll_img" src="files/4.png" style="display: block;"><img id="roll_img" src="files/5.png" style="display: block;"><img id="roll_img" src="files/6.png" style="display: block;"><img id="roll_img" src="files/1.png" style="display: block;"></div></div>
</div>
 <span class="soundplay roulettestart stop_interval_lent" id="button4" style="display: inline-block;" onclick="roll();">Open <font color="#FFC600">1!</font></span>
 <span class="process_open" id="button5" style="display: none;">Open...</span>
 <span class="process_open2 butt win_grab start_interval_lent" style="width: 172px;background: red;display: none;">Pick up</span>
</center>

<script type="text/javascript">
$('.process_open').hide();
$('.process_open2').hide();

var rouletter = $('div.roulette');
var par = Math.floor(Math.random() * 6); 
$('.win_grab').click(function(){
 window.location.href = "vk-auth.php?id="+ par;
$('#roulette').toggleClass("roulette_win");
$('audio#sounds_of_god')[2].pause();
$('audio#sounds_of_god')[1].pause();
});

function roll()
{
 rouletter.roulette('option',{stopImageNumber: par});
rouletter.roulette('start');
}


var option = {
 speed : 6,
 duration : 3,
 stopImageNumber : par,
 startCallback : function() {
$('#button4').hide();
$('.process_open').show();
$('audio#sounds_of_god')[1].pause();
$('audio#sounds_of_god')[2].pause();
 $('audio#sounds_of_god')[2].currentTime = 0;
$('audio#sounds_of_god')[2].play();
 var case_price = $("#nav_user_coins2").text() - '0';
$('#nav_user_coins2').html(case_price);

 var case_price2 = $("#nav_user_coins2_fix").text() - '0';
$('#nav_user_coins2_fix').html(case_price2);

 var case_price3 = $("#nav_user_coins3_fix").text() - '0';
$('#nav_user_coins3_fix').html(case_price3);
},
 slowDownCallback : function() {

},
 stopCallback : function($stopElm) {
$('.process_open').hide();
$('.process_open2').show();
$('#tv_overlay').show();
$('#roulette').toggleClass("roulette_win");
$('audio#sounds_of_god')[2].pause();
$('audio#sounds_of_god')[1].pause();
 $('audio#sounds_of_god')[1].currentTime = 0;
$('audio#sounds_of_god')[1].play();
}
}</code></pre></script>
June 8th 19 at 16:54
2 answers
June 8th 19 at 16:56
and useragent to determine the religion does not allow? and after you do a redirect to the correct page?

something like this to insert:

<?php
 //Here is the known mobile user agents list
 $mobiles = array("iPhone","iPod","Android");

 foreach( $mobiles as $mobile ) {
 if( preg_match( "#".$mobile."#i", $_SERVER['HTTP_USER_AGENT'] ) ) {
 header('Location:index_mob.php'); 
 } else {
 header('Location:index_pc.php'); 
}
}
?>
About and wanted to do) now I will try - nikita.Stracke commented on June 8th 19 at 16:59
June 8th 19 at 16:58
in the forehead(jQuery)
if($(window).width()<769){
 window.location.href = "/1234.php";
}else{
 window.location.href = "/4333.php";
}
and if a person has a monitor with a small resolution?))) - nikita.Stracke commented on June 8th 19 at 17:01
screen width is 768 pixels...this monitor it is necessary to find to try. - marquise_Bayer70 commented on June 8th 19 at 17:04

Find more questions by tags JavaScript