更改window.location时丢失窗口参考?

时间:2011-03-07 16:54:52

标签: javascript reference

在更改它的location.href之后,我基本上失去了对窗口的引用,任何帮助都非常感激。

var win = window.open(window.location,"foo","");
//win is referenced - all good
win.location.href = 'http://www.stackoverflow.com'
//url of window is successfully changed
//but I now no-longer have reference to this window 

1 个答案:

答案 0 :(得分:2)

一旦页面的位置发生变化,当前页面的所有执行都将结束。