How to go to a diffrent page and read it

Hi I have a question regarding how to go to a website and scan it for hyperlinks and save them in a variable. I want to do something like this

  Var everythingAdiffrentPageContains = //Go to some link and store it in this variable

   var pageLinks  = []; 
 var anchors    = everythingAdiffrentPageContains.getElementsByTagName('a');  
    var numAnchors = anchors.length;
    for(var i = 0; i < numAnchors; i++) {     

In other words I would like to go to some site and store all that sites Hyperlinks in an array, how would you do this in javascript?

Im not trying to connect to another domain. Im trying to connect to another apache webserver inside my lan that hosts a website that I would like to scan for links.


That type of behaviour is no longer allowed to be performed via scripting where it’s on a different domain.

When being done locally, you can load the page in to an iframe and use the contentDocument of the iframe to access it.

Otherwise, you’ll want to investigate a server-side solution for that, perhaps using curl

YQL might be an option.