Solved

Close popup window if opener window closed.

Posted on 2001-07-23
4
281 Views
Last Modified: 2012-08-14
How to close popup window if opener window closed.

Regards,
Hamid
0
Comment
Question by:HamidHossain
[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
4 Comments
 
LVL 15

Expert Comment

by:a.marsh
ID: 6308338
Assuming you have stored a reference to the child window in a variable called "winref" then in the opener window use this:

<body onunload="if(winref != null && !winref.closed){ winref.close(); }">


Ant
0
 
LVL 9

Accepted Solution

by:
nimaig earned 30 total points
ID: 6308344
While opening the child window you need to keep track of the reference of the Child Window
eg.

var childWin;

function openWin(){
     childWin = window.open("test.html","","");
}

If you have the reference then on unload event of the body, you can close the window

eg.
function CloseChildWindow(){
     if(childWin)
          childWin.close();
}


Calling the function :
<body onUnLoad="CloseChildWindow()">
0
 
LVL 1

Expert Comment

by:Y_ee
ID: 6310118
a.marsh  !!

this is funny you are all over I guess I apologies here too

ciao
Y
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7152101
________________________________________
do not accept this comment as the answer

this question has been abandoned. experts please
post recommendations below to help the moderators.



________________________________________
my recommendation
split.
a.marsh
nimaig
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

756 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