title: Javascript document.location redirect to a wrong url
body: <p>I use this following code to redirect if site was visited on mobile devices</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  &lt;!--
  if (screen.width &lt;= 978) {
  document.location = "mobile.mysite.com";
  }
  //--&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>I tested it on many devices. Why does the site redirects to <code>www.mysite.com/mobile.mysite.com</code> instead of <code>mobile.mysite.com</code> only?</p>