title: A button on my page takes me to Google, using pure Javascript, how do I wait for it to load?
body: <p>I have the following html code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;base target="_top"&gt;
    &lt;/head&gt;
    &lt;body&gt;
  
      &lt;h1&gt;Soemething&lt;/h1&gt;
      &lt;button id='btn'&gt;Take me to Google&lt;/button&gt;
  
      &lt;script&gt;
  
        document.getElementById('btn').addEventListener('click', doStuff);
  
        function doStuff() {
          window.location.assign("https://www.google.com/");
        }
  
      &lt;/script&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>How do I wait for Google to load before executing code on google.com such as doing a search?</p>
  
  <p>Thank you</p>