Solved

Redirecting the parent window on the close of the child.

Posted on 2002-05-22
4
657 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
Suggested Courses

737 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