window.top.location vs window.location

asdf_enel_hak picture asdf_enel_hak · Mar 18, 2011 · Viewed 27.3k times · Source

how to sync window.top.location and window.location?

Answer

Josh Stodola picture Josh Stodola · Mar 18, 2011

This is how you set the parent of the frame (top) to the location of the frame document...

top.location = self.location;

Of course, this code must be executed within the iframe, and is succeptible to the Same-Origin Policy.