title: How to get the status code of the page before it is loaded
body: <p>There is a javascript line (you can try it in the browser console)</p>
  
  <pre><code>window.location.href='http://example.com'
  </code></pre>
  
  <p>that will push you to <code>http://example.com</code></p>
  
  <p>In the Browser(Google Chrome)-> Developer Tools-> Network section you may see the Status is 200 for it.</p>
  
  <p><strong>The question is:</strong></p>
  
  <p>how to get the status code 200/404/302 right BEFORE executing </p>
  
  <pre><code>window.location.href='http://example.com'
  </code></pre>
  
  <p>Thank you.</p>
  
  <p>P.S. jQuery is OK for using.</p>