...

View Full Version : Need to refresh a window by specified name



SlowCoder
05-10-2007, 04:25 PM
I have a window, named using the following script at the top:
<script language='javascript'>window.name='Window1';</script>

I need to call a reload on this window from another window. I'm sure it would be a derivative of the following:
<script language='javascript'>window.parent.location.reload();</script>

Window1 is NOT the parent window of the other window that will reload it.

Help?

glenngv
05-10-2007, 09:42 PM
If Window1 is not related to the window that will reload it, the only thing I think that will get the window handle of Window1 is to open a blank window with that same name. Just make sure both windows are in the same domain.



function reloadWin(){
var w=window.open("", "Window1"); //get handle of Window1
alert(w.location.href); //check URL - test only
w.location.reload(true); //reload it
}

SlowCoder
05-11-2007, 06:35 PM
If Window1 is not related to the window that will reload it, the only thing I think that will get the window handle of Window1 is to open a blank window with that same name. Just make sure both windows are in the same domain.



function reloadWin(){
var w=window.open("", "Window1"); //get handle of Window1
alert(w.location.href); //check URL - test only
w.location.reload(true); //reload it
}

That was perfect, exactly what I needed! Thank you.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum