5

window.top.location と window.location を同期する方法は?

4

2 に答える 2

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.

于 2011-03-18T16:13:22.237 に答える
0

window.top.location は、i-frame またはページにいる場合でも、ブラウザのアドレス バーの場所に戻ります。window.location は、Facebook アプリの場合、現在のページ アドレスの場所を返します。クエリ文字列をトップにしたい場合は、使用する必要があります

alert(window.top.location);

上の位置を置き換えたい場合

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

于 2012-06-30T11:44:47.537 に答える