5

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

asdf_enel_hak
  • 7,474
  • 5
  • 42
  • 84

2 Answers2

5

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.

Josh Stodola
  • 81,538
  • 47
  • 180
  • 227
0

window.top.location is return you to broswer's address bar location even you'r in i-frame or page.. window.location is return location of your current page address in case facebook apps. if you want to top query-string you have to use

alert(window.top.location);

if u want to replace top location then

window.top.location = "http://whatever.com";

Dekel
  • 60,707
  • 10
  • 101
  • 129
Anant Dabhi
  • 10,864
  • 3
  • 31
  • 49