Feb 08, 2012, 8:23 AM
[CLOSED] Closing a parent window from a child iFrame button (dynamic window ID's)
Hi All,
I've got an situation where we'd like to close a parent window from a button within a nested child iFrame.
I've had a read around and most of the solutions seem to centre around using 'window.parent' and a reference to the WindowID. This works ok if you know the ID of the window, but with the app we're currently working it, we're using the desktop control, and window ID's are created dynamically.
This leaves us with a situation where if I Page.aspx it's ID might be 'win_1' whereas if I then open the same page again it might be 'win_2'.
Has anyone stumbled accross an effective mechanism to determine the parent windows ID from the child iFrame's button?
At the moment I've spent some time trying to use a recursive method to traverse the DOM up to the parent window (which seems to bail when I hit the top of the iFrame).
Also tried a few ways to pass the current window's ID about, perhaps in the querystring when opening it and then parsing that back out with window.document.location.search, that kind of thing.
I'm sure someone must have encountered this before, any pointers would be greatly appreciated.
Many thanks,
Doug
I've got an situation where we'd like to close a parent window from a button within a nested child iFrame.
I've had a read around and most of the solutions seem to centre around using 'window.parent' and a reference to the WindowID. This works ok if you know the ID of the window, but with the app we're currently working it, we're using the desktop control, and window ID's are created dynamically.
This leaves us with a situation where if I Page.aspx it's ID might be 'win_1' whereas if I then open the same page again it might be 'win_2'.
Has anyone stumbled accross an effective mechanism to determine the parent windows ID from the child iFrame's button?
At the moment I've spent some time trying to use a recursive method to traverse the DOM up to the parent window (which seems to bail when I hit the top of the iFrame).
Also tried a few ways to pass the current window's ID about, perhaps in the querystring when opening it and then parsing that back out with window.document.location.search, that kind of thing.
I'm sure someone must have encountered this before, any pointers would be greatly appreciated.
Many thanks,
Doug
Last edited by Daniil; Feb 09, 2012 at 10:05 AM.
Reason: [CLOSED]