title: How to test if link on page works
body: <p>I am trying to write a script that will test if all the anchor tags on a page are working. Essentially, I just want to make sure that the link is not broken. I thought that the best way to do this would be to loop through all of the anchor tags on a page and send an http request to that URL. See code below: </p>
  
  <pre><code>function testClicks() {
  
      for (var i = 0, allLinks = document.links.length; i &lt; allLinks; i++) {
          var thisLink = document.links[i].href,
              http = new XMLHttpRequest();
          http.open('GET', thisLink, false);
          http.send();
          var resonse = http.status;
          console.log(response);
      }
  
  };
  </code></pre>
  
  <p>Right now I am just testing basic links like Google and Yahoo. Right now this is the error I am getting. </p>
  
  <pre><code>Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://www.google.com/'. 
  </code></pre>
  
  <p>I am thinking that I should not be using the GET method. Any insight on this issue could help. Vanilla Javascript only please! No jQuery.</p>
  
  <p>Thanks,</p>