Here is my code,

```
 var links = document.getElementsByTagName("a");
 for(var i = 0 , max = links.length ; i < max ; i++){
       var refLinks = links[i].href;
       var xhr = new XMLHttpRequest();
          xhr.open('GET',refLinks, true );
          xhr.onreadystatechange=function() {
                  console.log("HTTP Status Code:"+xhr.status);
             }
          xhr.send(null);
}

```

Now in the console I am getting xhr.status is 0 for most of the links while those are not broken links and 200 for only few links. and the website I tried for is <http://www.scientificamerican.com/> .

Kindly help.