title: Break out of framed page before load
body: <p>I have a aspx page that is inside a frame. I want to redirect to a new page but before that page loads, break out of the frame. I was using this js code </p>
  
  <pre><code>window.onload = TimeOutRedirect;
  function TimeOutRedirect()
  {
      try
      {
      if (self.parent.frames.length != 0)
      self.parent.location=document.location;
      }
      catch (Exception) {}
  }
  </code></pre>
  
  <p>This works but it waits until the page loads so you can see the page in the frame before it breaks out. </p>
  
  <p>I tried using another page as a middle man but I can't redirect after page loads.</p>