title: Maintain redirection inside iFrame
body: <p>I am building an application where I want to load a page from another server into my page.  The particular page that I'm pulling data from depends on a query that is being run (with OAuth access) on that foreign server.  Once I get the URL for that page, I am loading it in an iFrame and displaying it on my page.</p>
  
  <p>The problem is, the URL that the query gives me is actually to a page that forwards three times before getting to where I actually want to go.  To make things more complicated, it also has frame-buster code on the initial page.  I set my page to redirect to a page that returns a 204 status on page unload so as to beat the frame-buster, but now it's just stuck displaying the initial blank page instead of the content I want, which is at the end of three redirects.</p>
  
  <p>My initial idea was to try to capture the code for the outgoing location request on page unload.  I had hoped to be able to see where the user is being redirected to and load that request inside the iFrame instead.  Repeat three times to get the correct page in the iFrame.  Intuitively, however, this felt like it shouldn't be able to work, and of course it does not because letting pages see where their users are going to upon leaving a site would be a major privacy issue.</p>
  
  <p>Next, I was thinking that maybe I could just parse each new page in turn as it was loaded into the iFrame to find the script for the redirect.  I'm pretty sure it's done on the server side, however, since looking at the code I was getting didn't turn anything up.</p>
  
  <p>I started looking for ways to maintain that redirection inside the iFrame.  That is, allow the redirect to occur, but force it to stay inside the iFrame while also preventing the frame-buster code from doing anything.  This would be the easiest solution, but I can't find a good way to do it.  Right now, I just have a blank page loading inside an iFrame, and I think there's something on the server side that performs the redirect that isn't running in the iFrame.  The frame buster code only prevents the entire document from changing, not the iFrame.  Is there a good way to do this or am I going about things the wrong way?</p>