Solved

Close popup window if opener window closed.

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

Regards,
Hamid
0
Comment
Question by:HamidHossain
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

707 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

13 Experts available now in Live!

Get 1:1 Help Now