Solved

Redirecting the parent window on the close of the child.

Posted on 2002-05-22
4
638 Views
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 window.open(...).  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
0
Comment
Question by:kaytrim
  • 2
4 Comments
 
LVL 22

Expert Comment

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

CJ
0
 
LVL 5

Accepted Solution

by:
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.
window.close;

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?


ALL THE BEST.
KCM
0
 

Author Comment

by:kaytrim
ID: 7037040
KCM,

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,
Michael
0
 

Author Comment

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

Michael Dove
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

746 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

10 Experts available now in Live!

Get 1:1 Help Now