Redirecting the parent window on the close of the child.

Posted on 2002-05-22
Last Modified: 2008-02-26
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
Question by:kaytrim
  • 2
LVL 22

Expert Comment

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


Accepted Solution

kcm76 earned 300 total points
ID: 7035034
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?


Author Comment

ID: 7037040

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,

Author Comment

ID: 7037415
Thanks KCM, just what I needed to get the job done.

Michael Dove

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now