title: Changing window location, then waiting for the window to load?
body: <p>Bear with me, I'm a complete noob to Javascript :P. So, what I want to do is use a function to load a web page. And, after that function is done I want to be able to grab the HTML code of a certain element on a page. Here's my code so far:</p>
  
  <pre><code>function change(){
      window.location = "www.aWebPage.com"
      window.onload = function() {
       return document.ID_HERE.outerHTML;
      }   
  }
  </code></pre>
  
  <p>For whatever reason the return of the HTML code doesn't work, but the redirect does. Am I return the value to the function properly? Is there another way where I could use multiple functions that only executed after the window has been redirected? </p>