Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refresh child pop up from parent page 1

Status
Not open for further replies.

bobrivers2003

Technical User
Oct 28, 2005
96
GB
Many threads I have checked ask for refreshing a parent from a child pop up, but I am after the opposite. I have a parent that could potentially open several popups.These pop ups query a database and display data.

If one pop up was open the user can simply press refresh to obtain the latest data. This can be annoying if many pop ups were open.

Is there a function i can put in the parent page that will refresh any popups that it opened?

e.g <input type="button" name="refresh" value="refresh" onClick="child.window.refresh();">


Any help would be greatly appreciated.
 
Top stuff. I did check the faq but missed that one.

Thanks for the pointer
 
Still having problems it IE gives an error when the button to refresh is clicked:

<html>
<head>
<script type="text/javascript">
<!--
var childWindowHandles = new Array();

function openNewWindow(url, params) {
childWindowHandles[childWindowHandles.length] = window.open(url, '', params);
}


function refreshChildWindows() {
for (var loop=0; loop<childWindowHandles.length; loop++) if (!childWindowHandles[loop].closed)

childWindowHandles[loop].reload(true);
}
//-->
</script>
</head>
<body> <input type="button" value="Refresh" onClick="refreshChildWindows();">
Click <a href="javascript:eek:penNewWindow(' '');">here</a> to open another new window.
</body>
</html>

Any help would be greatly appreciated
 
Sorry;

No error occurs in FF, but still doesn't work. Error is:

"Object does not support this property or method"

(Line 16 if this helps)
 
Aaah - it's probably because "reload" is not a method of thw "window" object. You probably need to drill down to the location object contained inside it.

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Not quite sure what that means so I tried:

location.childWindowHandles[loop].reload(true);

Error = "location.childWindowHandles is null or not an object"

and:


childWindowHandles[loop].location.reload(true);

Error="Permission Denied"

Sorry for the retarded response, JS isn't my strongest skill!
 
Not sure if I'm reading this right but that snippet is exactly the same to the second variation I tried:

childWindowHandles[loop].location.reload(true);

Error="Permission Denied
 
Dan you are a superhero.

Your efforts are so greatly appreciated. THANK YOU!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top