title: Javascript: Setting location.href versus location
body: <p>When would you set <code>location</code> to a URL string versus setting <code>location.href</code>?</p>
  
  <pre><code>location = "http://www.stackoverflow.com";
  </code></pre>
  
  <p>vs</p>
  
  <pre><code>location.href = "http://www.stackoverflow.com";
  </code></pre>
  
  <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/window.location" rel="noreferrer">Mozilla Developer Network Reference</a></p>