views:

404

answers:

1

Ok, so here's the deal:

Currently we have a page that calls a popup window and there is a link in that popup that redirects the parent page to another location. That all works just fine.

CURRENT: PRODUCT PAGE <--> POPUP

However, I am creating a new feature where the main page calls a new child window for product details. That product details page then has the link to the aforementioned popup. The problem is that the popup now sees the child window as its parent and the redirection happens there instead of in the main browser window.

DEVELOPMENT: MAIN SITE --> CHILD PRODUCT DETAILS <--> POPUP

Is there an event I can capture in the product details child before the redirection occurs so that I can pass that through to the next level?

TIA

Kevin

EDIT: Found this:

http://www.bennadel.com/blog/1520-Binding-Events-To-Non-DOM-Objects-With-jQuery.htm

But this just apprises you after the location has changed...

A: 

This is what I ended up doing...

function smartRedirect(newlocation)
{
    if (window.opener == window.opener.parent)
    {
        // main window opened us...
        window.opener.location.href = newlocation;
    }
    else
    {
        // must have been a child window... so change parent, then close this one...
        window.opener.parent.location.href = newlocation;

        // this is needed because when the child window/frame is killed,
        // window.opener becomes null.
        self.close();
    }
}
peiklk