title: How redirect mobile users to different url?
body: <p>I used the following script to redirect mobile users to a mobile site:</p>
  
  <pre class="lang-js prettyprint-override"><code>&lt;script type="text/javascript"&gt;
      if (screen.width &lt; 800) {
          var ref = document.referrer;
          var urls = new Array("http://www.ilsanlorenzo.net","http://www.ilsanlorenzo.net/mobsite");
          var n = ref.match(urls[0]);
          var m = ref.match(urls[1]);
          if ((m!==null) || (n!==null)) {
              stop;
          } else if (ref=='') {
              var r = confirm("Small Display is Detected.\nClick \"OK\" for MOBILE SITE.");
              if (r==true) {
                  window.location = "http://www.ilsanlorenzo.net/mobsite";
              } else {
                  stop;
              }
          } else {
              window.location = "http://www.ilsanlorenzo.net/mobsite";
          }
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>I would like to know if anyone knows a script to redirect mobile users to a mobile site version and tablet and desktop users to a web site version.
  Does anyone know a solution?</p>
  
  <p>Thanks for your time!</p>