title: How to get urls HTTP status code 403 with javascript
body: <p>i have following javascript code, i want to get HTTP 403 Forbidden response code by using javascript, i tried following code and modified it, but its not working for me..</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  var request = new XMLHttpRequest();  
  request.open('GET', 'https://domain.com/file', true);
  request.send();
  request.onreadystatechange = function(){
  
          if (request.status === 403) {  
              alert("Oh no, it does not exist!");
          }
  };
  
  
  
  &lt;/script&gt;
  </code></pre>