Forum Moderators: open

Message Too Old, No Replies

Referencing a function on the grandparent window

Is it possible without 'opener'?

         

AWildman

3:26 pm on Sep 22, 2005 (gmt 0)

10+ Year Member



Huge js challenge here. We have a grandparent window, which opens a parent window, which opens the active window. If a user closes the parent window, is it possible to reference a function on the grandparent window from the child?

In other words, If we lose our 'opener' reference by closing the second window, can the 3rd window reference a function on the first?

Dijkgraaf

11:45 pm on Sep 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well I would set the reference when the page is first loaded, and as long as page3 doesn't reload you can use the grandparent reference even if the parent is closed;

<script type="text/javascript">
var parent = window.opener;
var grandparent = parent.opener;

function doit() {
grandparent.doitgrandparent();
}
</script>