title: How can I use my same JavaScript code on a newly loaded page (from a redirect)
body: <p>I am basically trying to emulate user experience on multiple websites, so I want a single script that will redirect to a new website, start scrolling to the bottom, and then go back to the original site.  Here is my code, it loads the page just fine but does not scroll.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Benchmark&lt;/title&gt;
  &lt;script type="text/javascript"&gt;
  function loadUrl(newLocation)
  {
    window.location = newLocation;
    window.onload=pageScroll;
  }
  
  
  function pageScroll() {
          window.scrollBy(0,50); // horizontal and vertical scroll increments
          scrolldelay = setTimeout('pageScroll()',100); // scrolls every 100 milliseconds
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;a href="javascript:void" onclick="loadUrl('anysite.com'); return false;"&gt;link-1&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I have not gotten to the redirect back page, but that doesn't really matter yet.  Thanks!</p>