title: window.onload not working after page load in chrome developer console
body: <p>window.onload doesn't seem to run the specified function in the chrome console and I can't seem to find anyone with the solution.</p>
  
  <p>Code:</p>
  
  <pre><code>function preStart() {
      console.log("Hello");
  }
  window.location = 'https://www.google.com/';
  window.onload = preStart; //Please note, adding brackets here doesn't fix the problem
  </code></pre>
  
  <p>When ran the window.location successfully runs but "preStart" does not.
  I realize that <code>window.onload</code> doesn't work after <code>window.location</code> but is there a solution to this? (Where the function runs after the page loads)</p>
  
  <p>Since I am relatively new to JavaScript please explain any answers/solutions.</p>
  
  <p>Any help with this would me much appreciated.</p>
  
  <p>Note - I have tried <code>setTimeout</code> with the following and it still doesn't work:</p>
  
  <pre><code>function preStart() {
  console.log("Hello");
  }
  window.location = 'https://www.google.com/';
  setTimeout(preStart,2000);
  </code></pre>