I have 2 page index.php (For Desktop) and indexm.php (For Mobile). I want to redirect it with detection of screen resolution size. I'm trying this code
<script type="text/javascript">
    if (screen.width <= 720) {
        window.location = "indexm.php";
    } else {
        window.location = "index.php";
    }
</script>
and i am trying same in PHP,
<?php 
  if (screen.width <= 720) {
      include "indexm.php";
  } else {
      include "index.php";
  }
?>
But both the code is not working, Please help me with PHP or JavaScript code to make it work.
 
     
    