title: redirect desktop users to another page and mobile user to the main page
body: <p>I have a problem with this code.I want to redirect my desktop users to block.php page and dont let them in.</p>
  
  <p>i tested a lot of code and non of them work for me.</p>
  
  <p>at the moment,i found this code.its works perfectly...but there is e tiny problem.</p>
  
  <p>when i check my site with mobile ( ios device )..it keeps <em>reloading</em></p>
  
  <p>this is the code : </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;script&gt;
  
  if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i)) { 
      window.location.assign("http://example.com"); 
  } else { 
      window.location.assign("http://example.com/block.php"); 
  } 
  
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>what is the problem?</p>