Redirecting the parent window on the close of the child.

Trying to 'elimanate' the back button on an asp/javascript data collection site we have opened a child window with all the necessary toolbars disabled using  When certian events happen I would like to close the child window and redirect the parent window.  The certian events and the desired parent actions are as follows:

Child Action                  Parent Location
Session Timeout               Login Page
Close Window                  Main Menu page

The Session Timeout is a page with a link to the Login Page.  Right now the Session Timeout opens in the child window.  Is there a way to determine of the page is opened in the named child window?  If so how can I close this child window and redirect the parent to the Session Timeout page.  Or could I change the link on the Session timeout to just redirect the parent to the login page.

Is there a unload event for the browser?  If so what code will I need to use to redirect the parent to the main menu page.

Please answer with complete javascript functions not code snippets.

Thank you in advance,
Michael Dove
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Chandramouli kConnect With a Mentor ArchitectCommented:
in the child window if the session timesout u want to close the child window and open the login page in the parent window. in that case.write the following code in the child window.
// this will open the login.asp in the parent window
window.opener.location.href = "login.asp";

// close the child window.

similarly u write the same in the onunload event.
window.opener.location.href = "mainpage.asp";

btw, what do u mean by
Child Action...........Parent Location?

What kind of error page is sent back to the client? IS it a normal page you supply?

kaytrimAuthor Commented:

Thanks for the code this I will try it out and let you know.  

The Child Action is what happens on the child window.  The Parent Location is where I want the parent window to redirect to.

Thanks again,
kaytrimAuthor Commented:
Thanks KCM, just what I needed to get the job done.

Michael Dove
All Courses

From novice to tech pro — start learning today.