title: URL Redirect Based on Screen Width
body: <p>What I'm looking for is quite simply, a way to automatically redirect the user to a different URL when the screen or window width is less then 950px.</p>
  
  <p>I don't want to use "refresh" as it's not recommended, and I don't do want to use "User Agent" either as it seams to me less reliable in the long term and I don't want to be concerned with updating this.</p>
  
  <p>This is the Script I see suggested everywhere for this purpose but for some reason it doesn't do anything:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    &lt;!--
    if (screen.width &lt;= 950) {
      window.location = "https://www.google.com/";
    }
    //--&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>I've also tried it with all this variants with no success:</p>
  
  <pre><code>window.location
  document.location
  window.location.href
  document.location.href
  </code></pre>
  
  <p>I've also tried placing it as the first thing after Head tag and even before Doctype. Nothing happens...</p>