Click to See Complete Forum and Search --> : Need help with code for refreshing page


ts10sc
10-07-2003, 03:12 PM
Hi, I am trying to use one page to refresh another browsers page. The page I am trying to refresh is named "main". I have used:


<script language="javascript">
window.opener.location.reload()
window.close()
</script>


To refresh the opener page and close the current one - however, the page I need to refresh now is not the opener.

I have tried:


window.main.location.reload()



and


main.location.reload()



to no avail. Any ideas how to get my page to refresh another's page?

Thanks!

gil davis
10-07-2003, 03:50 PM
You have to make a pointer:
var mainWin = window.open("","main");
mainWin.location.reload();
If someone has closed the window called "main", the function will open an empty window with no history and cause an error. In that case, you'll need to test the window's location to see if it contains the right page, or some other object you know should exist in the window in order to avoid an error.

ts10sc
10-08-2003, 09:01 AM
Thank you so much! Worked perfectly.